Lisp routine to insert hardware blocks

Lisp routine to insert hardware blocks

DMeeson
Explorer Explorer
1,028 Views
6 Replies
Message 1 of 7

Lisp routine to insert hardware blocks

DMeeson
Explorer
Explorer

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

0 Likes
Accepted solutions (1)
1,029 Views
6 Replies
Replies (6)
Message 2 of 7

rkmcswain
Mentor
Mentor
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
0 Likes
Message 3 of 7

DMeeson
Explorer
Explorer

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

0 Likes
Message 4 of 7

rkmcswain
Mentor
Mentor
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
Explorer
Explorer

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 

0 Likes
Message 6 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution

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 "" "" "")
0 Likes
Message 7 of 7

DMeeson
Explorer
Explorer

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

0 Likes