How to create a hatch on an object in Dynamo

Hello,
I’m looking to create hatches on objects other than polylines in Dynamo. Are there any nodes or Python scripts that I can use for this purpose? If you know, please provide the information. Thank you in advance.

Welcome to the forum.
What have you tried to do?

1 Like

Thank you for your response.
I want to create a hatch on a region object in Dynamo.

Yes I understand that but what have you tried to do before you ask here? Because we would love help you but you need to try by your self and upload some dyn-files.
If you use the search function you will find that there is nodes to create hatches in the Arkance package

1 Like

I’m sorry,

I want to create a hatch on an object in Dynamo, but packages like Arkance only seem to provide nodes for creating hatches from polylines or polycurves. I’m looking for a way to create hatches on solid objects or similar. Is it possible to achieve this in Dynamo?


Sorry, I misunderstood you.
So, you want to create the hatch to be visible on an object inside Dynamo? Am I correct?

Hola amigo @eri buenas, como estas?? autocad can only create a hatch inside a bounded region, I mean inside a region created by a closed polyline, I used the Hatch.byGeometry node of Civil3DToolkit package, but Arkance nodes work similar, hope it helps!

I apologize for any confusion.

I would prefer to find a solution within Civil 3D. While I can load the region I want to create the hatch on using “Select Objects,” I cannot convert it into Dynamo geometry using “Object.Geometry.” It seems that I need a node or Python script to create a hatch within Civil 3D using Dynamo. Is there a way to resolve this?

Amiga @eri hola de nuevo! No, you don’t need to apologize either using phyton or black magic, you need to convert your objects in a closed region, I hope this will help you!

1 Like

Hello,
We already know how to create a hatch from a closed polyline (nodes in Hatch.ByGeometry, nodes in Hatch.CreateHatch).
I would like to create a program as shown below, but currently there are no nodes like " ".

Select Objects (multiple regions on AutoCAD) ⇒ “Create Hatch”

AutoCAD’s HATCH command allows you to create hatches from regions. That’s what we want to achieve with Dynamo.

Hola Amigo @oh_ruki buenas. ok now i understand better that is a much clear question, i see 2 possible scenarios:

  1. previously define a criterion that allows you to filter the different elements that compose a border like layer, size or type of line, etc. but I think that would imply more manual work.

  2. create a large surface and divide this surface in smaller regions with those lines as subregions, then those subregions get the perimeter lines and create the Hatch.

Do you have any .dwg to try?

Thanks for other methods

send a dwg with multiple regions on AutoCAD that you want to try
Please here

region_hatch_test.dwg (891.0 KB)

Is not very normal to work with Regions in Autocad, there are not to many nods to work with directly, you can use rectangles or polylines directly is easy to get the geometry, any way is the same logic you take the geometry of the objects you make the closed region in dynamo (Closed polycurve i mean) and make the hatch base on this created gemoetry.



1 Like

Hi
The forum language is english, please use Google translate if you don’t feel comfortable writing in english.

Excuse me, I can’t because there are areas not only square, but also triangles, etc. Other than this method, is it difficult to decompose the area with “Object.Explode” and create a polycurve with a dynamo unless it becomes a line?

An alternative way is to extrude the region into 3dSolid with a fixed height, like 1 or 100, then import the 3dsolid in Dynamo to get the bottom surfaces and perimeter curves as region outlines.
AutoCAD API for 3dsolid has “extrude” method to create one from region.

I know its not Dynamo but I used to do it with LISP. If you cant find a way in Dynamo this might be usefull in the meantime. However keep in mind: Dynamo Forum here…

(prompt "\Hatch_Objects.lsp loaded, Enter 'Hatch_Objects' to execute")
(defun c:Hatch_Objects (/ OLDCE SSET CNT OBJ)
  (setq OLDCE (getvar "cmdecho"))
  (setq cla (getvar 'clayer))
  (setvar "cmdecho" 0)
  (princ "\nSelect Objects: ")
  (setq SSET (ssget '((-4 . "<OR")(0 . "*POLYLINE")(0 . "REGION")(-4 . "OR>"))))
  (setq CNT -1)
  (while (setq OBJ (ssname SSET (setq CNT (1+ CNT))))
(command "laymcur" OBJ)
(command "_.bhatch" "_select" OBJ "" "")
)
(setvar "cmdecho" OLDCE)
(command "-layer" "s" cla "")				;Restore user settings
(princ "\nnumber of objects: ")
(princ CNT)
(princ "\n")
(princ)
)

You can can refer to this post Wipeout from Polyline - #6 by jacob.small on how to run command from within Dynamo to directly create hatch from region, in case you have no idea how to use lisp. Obviously the LISP only calls hatch command to generate hatch.

1 Like