Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp to hatch blocks on multiple UCS planes.

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
mstefanon
619 Views, 8 Replies

Lisp to hatch blocks on multiple UCS planes.

Hi, Can someone please create a lisp that: will automatically hatch all blocks within a selection. The blocks are all on difference planes and UCS's. is this do-able. I haven't had experience writing lisp codes.

 

The file attached shows 1 structure that has no hatching, and the other structure hatch been manually hatched, which thats quite some time. This is the end result. However there is some minor adjusting on corners structures

Tags (2)
8 REPLIES 8
Message 2 of 9
Sea-Haven
in reply to: mstefanon

The green object is a bit weird to me are you trying to draw some form of panels ? Some blocks appear to be just a line ? The gaps are not helping.

 

There may be way better methods for drawing these objects, maybe a rectang with a thickness. Why are all the objects in different UCS ? 

 

Just thinking randomly is this a part of a bigger 3d dwg maybe, If all the objects have their own XYZ points in 3d then could make a TIN surface this would join all the 3dpoints in a surface that could be hatched.

 

I think a more detailed dwg may help than just hatch the white rectangs this will not fix the trim up to the green lines.

 

 

Message 3 of 9
mstefanon
in reply to: mstefanon

Hi, 

Thanks for your response,

 

The blocks drawn represent canopy cloths. Our business construct netting infrastructures over various sized and oddly shaped fruit orchards and few other industries. The drawn blocks represent clothes and we extract data from each block to calculate all the components (wire & net etc). Majority of our work is never square!

Some designs have angled or vertical side cloth from ground to a design height above ground at 5metres (green blocks). The canopy netting is the white blocks broken into sections. The Canopy netting is quite simply to hatch in manually, however when we have many "green block" all at different UCS’s the task becomes very tedious.

Message 4 of 9
Kent1Cooper
in reply to: mstefanon

That may not be too difficult, using UCS's OBject option with each Block, if you want the entire area of each Block Hatched.  But apparently you don't -- what about the areas in Blocks that are not Hatched [yellow-squiggled parts here]?

Kent1Cooper_0-1643123439337.png

 

Kent Cooper, AIA
Message 5 of 9
Sea-Haven
in reply to: mstefanon

Need some time to think about it more but I still think a TIN of 3dfaces may be the way to go as they are made from 3d points and breaklines, so gaps does not matter. One advantage in 3dfaces can get area etc. 

 

Need a 3dpolyline that is say the inside side of the green lines in your net dwg. Can be multiples.

 

Not sure why your using UCS to draw the blocks v's say 3dpoly or a Pface may be even better. Pface are an object that is in one plane but drawn from ucs World, Look at a house roof each part can be drawn as a pface taking 3d values.

 

Looking at it in 3D there may be an answer taking the top of the poles as 3d points 

 

SeaHaven_0-1643171343987.png

 

Message 6 of 9
mstefanon
in reply to: Kent1Cooper

In regards to the sections where you highlighted yellow - i had manually adjusted the hatch nodes to make the hatch pattern shaped into a triangle. I understand that will be a manual task. I should of pointed that out from the start. @Kent1Cooper 

Message 7 of 9
CADaSchtroumpf
in reply to: mstefanon

A summary piece of code to give a starting idea!

For the horizontal hatches you used a polyline made manually?

I cannot reproduce it because your nets do not offer a closed contour.

(defun c:net_hatch_block ( / js model_hatch scale_hatch ang_hatch hatch_ltscale n ent)
  (setq js (ssget '((0 . "INSERT") (67 . 0) (8 . "M_PANELS") (2 . "CanopyCloth#,SideCloth*"))))
  (cond
    (js
      (setq
        model_hatch (getvar "HPNAME")
        scale_hatch (getvar "HPSCALE")
        ang_hatch (getvar "HPANG")
        hatch_ltscale (getvar "CELTSCALE")
      )
      (setvar "HPNAME" "NET3")
      (setvar "HPSCALE" 6.0)
      (setvar "CELTSCALE" 0.0025)
      (setvar "CLAYER" "PANELSHATCH")
      (setvar "CMDECHO" 0)
      (repeat (setq n (sslength js))
        (setq ent (ssname js (setq n(1- n))))
        (if (equal (cdr (assoc 210 (entget ent))) '(0.0 0.0 1.0))
          (setvar "HPANG" 1.727875959474386)
          (setvar "HPANG" 0.0)
        )
        (command "_.UCS" "_Object" ent)
        (command "_.HATCH" "" "" "" ent "")
      )
      (command "_.UCS" "_World")
      (setvar "HPNAME" model_hatch)
      (setvar "HPSCALE" scale_hatch)
      (setvar "HPANG" ang_hatch)
      (setvar "CELTSCALE" hatch_ltscale)
      (setvar "CLAYER" "0")
      (setvar "CMDECHO" 1)
    )
    (T (princ "\nBlocks \"CanopyCloth1,CanopyCloth2,SideCloth1,SideClothCorner1\" not founds!"))
  )
  (prin1)
)
Message 8 of 9
mstefanon
in reply to: CADaSchtroumpf

@CADaSchtroumpf Wow!!! Thanks so much for this. Works great! 😃

Message 9 of 9
Sea-Haven
in reply to: mstefanon

I just worked of the poles and got this shape as a outer boundary which I would expect you have. If you want rolls of netting of a known width and length then they can be laid on the shape arrayed and auto trimmed using the outline, have done something similar for concrete slab on ground waffle panels. They wont take into account the Z difference which comes back to use 3d points and TINS.

 

SeaHaven_0-1643775485454.png

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report