Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp routine to insert hardware blocks

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
DMeeson
672 Views, 6 Replies

Lisp routine to insert hardware blocks

Hello Forum,

 

  I have written a lisp routine that takes user input along with two point locations and inserts blocks of our hardware from our library in the correct orientation and place. Sometimes it works perfectly, other times it places the blocks in all sorts of strange ways. I haven't been able to figure out if it's because of the UCS or if it has something to do with the user input. Any help would be appreciated. All of the blocks are referenced off of 0,0,0.

 

Thank you,

Doug

6 REPLIES 6
Message 2 of 7
rkmcswain
in reply to: DMeeson

I didn't read every single line, and I did see that you are setting OSMODE, but many times, I see lisp files do strange things when creating geometry due to OSMODE not being what is expected, so certain object snaps are being acquired and not expected.

Non-WCS could be the issue too. Does it only happen in non-WCS drawings?


R.K. McSwain     | CADpanacea | on twitter
Message 3 of 7
DMeeson
in reply to: rkmcswain

I haven't looked yet into whether or not setting the UCS to World prior to running the lisp affects it; doing so now.

 

rkmcswain,

 

  no obvious difference between setting WCS and UCS before running the lisp. The lisp does change the UCS to align with the two points that the user inputs; could that be an issue?

 

Thank you,

Doug

Message 4 of 7
rkmcswain
in reply to: DMeeson

I can't test it since it's peppered with all the hardcoded block locations, but since OSMODE = 4, is there any chance a CEN object snap is being acquired when it shouldn't be?

R.K. McSwain     | CADpanacea | on twitter
Message 5 of 7
DMeeson
in reply to: rkmcswain

rkmcswain,

 

  We set this up to be OSMODE = 4 because our system is to draw solid objects (say two pine 2x4s or something), subtract a pass-thru hole and insert the washers, nuts and bolts based on the centerpoint of the hole. This lisp is designed to take those two points, align the UCS to that "line", measure the distance as well as add in additional for the washer and nut quantity and type, then choose the appropriate length of bolt and insert all that into the model. Perhaps that is too much for one lisp?

 

  Would sending you some of the blocks help?

 

Thanks,

Doug 

Message 6 of 7
ВeekeeCZ
in reply to: DMeeson

hi... it must be osnaps... try to add "_none" for osnap mode if front all points you set inside of (command), then you see... Like this:

 

	   (command
	     "_-insert"
	     "H:\\Drafting\\Blocks\\3d Blocks\\TestLib -R13\\Hardware\\Washers\\FlatWasher\\WASHR FLAT 8"
	     "_none" pt2 "" "" "")
Message 7 of 7
DMeeson
in reply to: ВeekeeCZ

BeekeeCZ,

 

  Thank you! Added that "_none" bit to all of the insert commands and it runs very smoothly now.

 

Also, since I'm new to lisp writing, does anyone see something that I could / should do better for the next one?

 

Thanks,

Doug

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

Post to forums  

Forma Design Contest


AutoCAD Beta