AChartier627 Posted March 10, 2021 Posted March 10, 2021 I am using a LISP routing to find 2D versions of steel construction beams in a plan view drawing and I am inserting 3D versions of the beams. In summary I select all the blocks in the drawing with the names that correspond to the 2D beam blocks I am considering. I perform a "repeat for the length of the selection set" For each block in turn I find the x and y coordinates of the insertion point, the insertion rotation, and the value of an attribute that represents the z coordinate. I then insert the appropriate 3D block from a suite of blocks I have created. This block is inserted at the x,y,z coordinates that is concatenated from the x & y coordinates of the 2D block and the elevation attribute. the rotation is adjusted to match the 2d block. the length of the beam is adjusted using some of the incredibly useful code published by Lee Mac. Below is a screen shot that shows a small section of my drawing. My code has correctly positioned about 95% of the beams in the drawing. However, the remaining few are misplaced by random amounts. The highlighted beam is at the correct z-coordinate, but both the x and y coordinates are incorrect. In the snapshot below there is a beam where x and z are correct but y is incorrect. I thought this might be an issue related with OSMODE so I set it to 0 before I start. I also get better results if I "Zoom" to each element in turn. I have attached my LISP file for your consideration. Many thanks in advance. Steel2Dto3D_Ver210308.lsp Quote
BIGAL Posted March 11, 2021 Posted March 11, 2021 (edited) There is a known bug in Autocad lisp that sometimes if you can not "SEE" what your doing on the screen Autocad does funny things, it pops up very rarely, so use "zoom C pt Scale" to get around it, the point would be say beam end. Not tested on your code. A couple of suggestions add the block path to your Support directories then can use just block name no need for path. An extra hint a undocumented help is add ".." to end of path this says go to sub directories also you dont need to add each one. \\BEAMS.. You have BEAM_TYPE "250UB 37.3" rather than a cond could use a simple substr function to strip the .3 off the end. 1 line of code compared to cond. (setq BEAM_TYPE (substr BEAM_TYPE 1 (vl-string-search "." BEAM_TYPE ))) Edited March 11, 2021 by BIGAL 1 1 Quote
AChartier627 Posted March 11, 2021 Author Posted March 11, 2021 Thank you for the advice. I will check it out. I find LISP a challenge to understand and it would be verging on impossible without help from people like you. Quote
AChartier627 Posted March 11, 2021 Author Posted March 11, 2021 (edited) Worked like a charm. There is a reason why you are a "CAD Guru". Edited March 11, 2021 by AChartier627 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.