Problem to Insert a Dynamic Blocks via script

Problem to Insert a Dynamic Blocks via script

nadiabelghithia88
Participant Participant
787 Views
7 Replies
Message 1 of 8

Problem to Insert a Dynamic Blocks via script

nadiabelghithia88
Participant
Participant

Hello to all,

I'm looking for a way to generate a script to insert a dynamic block.

Doing the insert command in a script is no problem, but the bock not take the correct coordinate X,Y.

So what is the worry!! lack of syntax in the line of script or graphic problem or .... !!   🤔  😔

 

For information, i'm using an AutocadMap 2017 (Frensh version)

 

I attache a .txt file contain all the lines of script in order to verify the command with me.

(Of cource, the .scr file will be lanced in autocad map)

 

 

 

 

 

0 Likes
Accepted solutions (2)
788 Views
7 Replies
Replies (7)
Message 2 of 8

cadffm
Consultant
Consultant
Accepted solution

Hi,

 

I guess your current setting of running osnaps and the current view while insertion is the issue.

You forget to handle the enabled osnaps.

 

Solution1

add the _none statement for "next point, don't use any osnap"

-inserer pointBloc _none
564354.4,283077.5,0.0 1 1 0
-inserer pointBloc _none
564383.5,283041.9,0.0 1 1 0
-inserer pointBloc _none

 

 

Solution2

Set up AutoCAD to ignore the running osnaps also in automations like a script, macro or (send)command

 

 

_osnapscoord 1

-inserer pointBloc
564354.4,283077.5,0.0 1 1 0
-inserer pointBloc
564383.5,283041.9,0.0 1 1 0
-inserer pointBloc
564434.5,283114.1,0.0 1 1 0

 

less smart idea solution3: Disable the running osnaps

worst solution3, remove all running osnap settings.

 

Sebastian

Message 3 of 8

pendean
Community Legend
Community Legend
Accepted solution

Add this as the top line of your SCRIPT file

 

_OSMODE 0

 

 

 

0 Likes
Message 4 of 8

АлексЮстасу
Advisor
Advisor

Hi, @nadiabelghithia88 

 

I replaced "-inserer" with "_-insert" (but this is probably not necessary). Replaced "pointBloc" with "pointBloc" - with a space at the end.
And put everything in dwg + Enter at the end.
1922 blocks were inserted.

pointBloc.png

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 5 of 8

nadiabelghithia88
Participant
Participant

Thank you very much for the answers,

 

@CADffm

the Solution 1 gives good result 🙂

the Solution 2 --> autocad writes    _osnapscoord     unkown command

 

@pendean 

_OSMODE 0  gives good results 🙂 

thank you

Can You explain this syntax to me.

 

0 Likes
Message 6 of 8

pendean
Community Legend
Community Legend

@nadiabelghithia88 an underscore before the commandname allows the use of the core "English" spelling without being affected by a user's local language being different.

OSMODE is explained here https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/AutoC... (it brutally removes all running object snaps, the problem you faced).
0 is the numeric zero (see link above for explanation).
The blank space in between is the same as hitting the <enter> key on your keyboard.

OSNAPCOORD is explained here https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2021/ENU/AutoC...

HTH

Message 7 of 8

cadffm
Consultant
Consultant

Sorry for my typo osnapscoord vs osnapcoord..

Sebastian

0 Likes
Message 8 of 8

nadiabelghithia88
Participant
Participant

Hello @cadffm 

Yes, I tried _osnapcoord 1 that given a good results also 🙂

 

 

0 Likes