Jump to content

Block Insertion Accuracy


AChartier627

Recommended Posts

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.

image.png.1d4070dbd44180a80cea65971580dd4b.png

 

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.

 

image.png.7b29786a97a9d241eb2308d2cca9eb5b.png

 

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

 

Link to comment
Share on other sites

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 by BIGAL
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Worked like a charm. There is a reason why you are a "CAD Guru".

Edited by AChartier627
  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...