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

Convert LSP to Metric

4 REPLIES 4
Reply
Message 1 of 5
bparker02
578 Views, 4 Replies

Convert LSP to Metric

Hello Everyone!

I don't really know a lot about lisp routines and a coworker gave this one to me to draw in lines for an arched opening in a reflected ceiling plan. If you imagine you have a 6" by 3' rectangle that would be the head of a door for example it somehow draws lines at points in this arch at parabolic distances. The only problem is I don't know how to make it work in my metric, millimeter drawings. The lines that it draws appear to take all the measurements and scale them up by 25.4, which makes sense since 25.4mm=1". Can someone help? I'm sure I just need to change a command prompt but don't know which one or to what.

Thanks!

 

4 REPLIES 4
Message 2 of 5
Kent1Cooper
in reply to: bparker02


@bparker02 wrote:

Hello Everyone!

I don't really know a lot about lisp routines and a coworker gave this one to me to draw in lines for an arched opening in a reflected ceiling plan. If you imagine you have a 6" by 3' rectangle that would be the head of a door for example it somehow draws lines at points in this arch at parabolic distances. The only problem is I don't know how to make it work in my metric, millimeter drawings. The lines that it draws appear to take all the measurements and scale them up by 25.4, which makes sense since 25.4mm=1". Can someone help? I'm sure I just need to change a command prompt but don't know which one or to what.

Thanks!

 


If they're simply 25.4 times too big, you should be able to do that either by [the better way, in my opinion] scaling everything in arch.dwg down [using its INSBASE System Variable value for the scaling base point] to one 25.4th size, or [the "cheating" way] by changing this in the routine:

 

 (command "-insert" "arch.dwg" SP DX HT AX)
 

to this:

 

 (command "-insert" "arch.dwg" SP (/ DX 25.4) (/ HT 25.4) AX)

Kent Cooper, AIA
Message 3 of 5
brooky
in reply to: bparker02

all I see that is units sensitive is  the line where you actually units.

Make sure responses are metric (decima).

The other is where the block "arch.dwg" is inserted.

This you can insert at 25.4 or make a metric block and keep at 1.0

 

try thst

Message 4 of 5
bparker02
in reply to: Kent1Cooper

To be honest I don't even know how the lisp creates the arch.dwg file? Is it just based off of the arch.lsp name? Does every lisp create a new dwg file? I also just don't see in the code how it divides the overall width and draws in the other lines. Is this lisp referencing another file? Maybe I'm not viewing the source code properly. I'm just opening it with notepad, am I missing something?

 

Thanks for the help with the cheating code line, everything works great now!!

Message 5 of 5
Kent1Cooper
in reply to: bparker02


@bparker02 wrote:

To be honest I don't even know how the lisp creates the arch.dwg file? Is it just based off of the arch.lsp name? Does every lisp create a new dwg file? I also just don't see in the code how it divides the overall width and draws in the other lines. Is this lisp referencing another file? Maybe I'm not viewing the source code properly. I'm just opening it with notepad, am I missing something?

 

Thanks for the help with the cheating code line, everything works great now!!


No, Lisp routines do not usually create drawing files [though they can be made to when needed].  The arch.dwg file would need to exist already, somewhere in your Support File Search Path list in the Files tab in Options, where you should be able to find it and scale its contents down to make it a millimeter-oriented drawing, and get rid of the dividing that corrects for its being an inch-oriented drawing.  The dividing of the overall width for the other Lines is built into arch.dwg, and the routine Inserts that and Explodes it, so the pieces end up as Lines again, and not part of a Block.

 

Maybe it would better to change the units basis of arch.dwg, instead of scaling its pieces.  I don't get to work in metric [I wish we here in the US would make that change, as used to be threatened years ago], so I'm not positive how to juggle between them, but I think whether it's imperial or metric, its content should fill a one-drawing-unit square [or a little less in one direction, because the sides of the opening would presumably already be drawn], so that the scaling part of the routine works right with the size of the opening.  I know you can designate the insert units when making a drawing with Wblock, and the Drag-and-drop units with Block, but I'm not sure how to change it in an existing drawing.

Kent Cooper, AIA

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

Post to forums  

Autodesk Design & Make Report

”Boost