How to scale and position using Insert command

How to scale and position using Insert command

prajputZ23VK
Contributor Contributor
971 Views
11 Replies
Message 1 of 12

How to scale and position using Insert command

prajputZ23VK
Contributor
Contributor

Hello Everyone,

I am new autocad programming, need some help with below script.

 

I am using below script to import the dxf file into the exiting drawing.  This works fine, after running this script it ask me for the point for placement and after selecting it places the drawing.

(command "_.insert" "C:\\File\\\\Test\\Test.dwg" pause "" "" ""). 

 

But I need to scale the importing dxf and place it particular place in the drawing. Any input to update the about command with these requirements.

Thanks in advance for your help. 

 

Regards,

PP

0 Likes
Accepted solutions (3)
972 Views
11 Replies
Replies (11)
Message 2 of 12

JBerns
Advisor
Advisor
Accepted solution

@prajputZ23VK,

 

Replace the quotation marks with pause functions. For example, this will pause for insertion point, x-scale, y-scale and then use the default rotation angle:

(command "_.insert" "C:\\File\\\\Test\\Test.dwg" pause pause pause "")

 

You could also remove the pause and quotation marks. AutoCAD will prompt for insertion point, x-scale, y-scale, and rotation.

(command "_.insert" "C:\\File\\\\Test\\Test.dwg")

 

Let us know if this answers your question.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 3 of 12

Kent1Cooper
Consultant
Consultant
Accepted solution

[Is it a .dwg or a .dxf?  Either way....]

If you give the INSERT command the Scale option before the pause for the insertion point [that's the second pause here; you supply the scale at the first pause], you can drag it into place already scaled:

 

(command "_.insert" "C:\\Your\\File\\Path\\whatever.dxf" "_scale" pause pause "")

 

Or, if there's a specific scale you would always use, such as a number or perhaps something like (getvar 'dimscale), put that in place of the first pause.

Note that the Scale option applies to all scale factors, so it won't ask for separate X & Y.  This is helpful even at a scale factor of 1 when the Block in question may or may not be defined for uniform scaling, so you don't know how many scale factors it's going to ask for.

 

You can put in a "particular place" instead of the second pause if what you mean is that it's already known and you don't want to drag it into place -- here supplying both a specific scale factor and a specific insertion point:

 

(command "_.insert" "C:\\Your\\File\\Path\\whatever.dxf" "_scale" 3 '(10.0 12.0 0.0) "")

 

That can be in an XYZ coordinates list as shown, or the contents of a variable can be fed in.

Kent Cooper, AIA
Message 4 of 12

devitg
Advisor
Advisor
Accepted solution
(command "_.insert" "C:\\File\\\\Test\\Test.dwg" pause pause pause  ) 

 

first pause for insertion point 

2nd for scale

3rd fro rotation 

0 Likes
Message 5 of 12

Kent1Cooper
Consultant
Consultant

@devitg wrote:

....

2nd for scale

.... 


... if it's defined for uniform scaling.  Otherwise you'll need to supply two scale factors.

Kent Cooper, AIA
Message 6 of 12

prajputZ23VK
Contributor
Contributor

Hello Jerry,

 

Thanks for quick response, yes it worked without any issue. 

 

Thank you very much for you help.

 

Regards,
PR

Message 7 of 12

prajputZ23VK
Contributor
Contributor

Hello Kent,

 

Thank for your detailed information on this command and quick reply

 

I am able to solve both my requirement with your command.

 

Thanks again for your help.

 

Regards,
PR

Message 8 of 12

devitg
Advisor
Advisor

@Kent1Cooper , please what system variable or command define for uniform scale?

 

defined for uniform scaling

 

0 Likes
Message 9 of 12

Kent1Cooper
Consultant
Consultant

When defining a Block:

Kent1Cooper_1-1659150433593.png

 

Kent Cooper, AIA
0 Likes
Message 10 of 12

Sea-Haven
Mentor
Mentor

Kent you may have solved another problem for me with a client project  when does a -insert need a 1 1 0 or just 1 0, the block scale uniformly may be creeping in. I am going to use scale option to avoid it hopefully. (-insert bname "S" 1 pt 

 

Just checked with a scale uniform set on and off for 2 blocks and yes get 1 scale request or 2 X Y.

 

You never stop learning.

0 Likes
Message 11 of 12

Kent1Cooper
Consultant
Consultant

You can change that about a Block, if you want.  Open it in BEDIT [not REFEDIT], and in the Properties palette there is a Scale uniformly slot for it, with Yes/No choice.

Kent Cooper, AIA
Message 12 of 12

Sea-Haven
Mentor
Mentor

Thanks Kent I understand but its  a clients dwg and it has 1100 blocks in it so much easier to go around it for what I am doing for them. The blocks vary between scale uniformly ticked on or not.

0 Likes