"-INSERTCONTENT" not functioning as expected

"-INSERTCONTENT" not functioning as expected

mspeace
Enthusiast Enthusiast
604 Views
5 Replies
Message 1 of 6

"-INSERTCONTENT" not functioning as expected

mspeace
Enthusiast
Enthusiast

I have an older LISP routine I'm trying to get working in my new company. I used to use the "-insert" command but that was not working. 

 

we have a drawing called "General.dwg" that contains block definitions for basic sheet layout. Things like north arrow, title blocks, logos, match lines etc. I want to insert 2 of the block defined in that drawing. The full Path for the drawing containing the blocks is,

 

"C:\RICK_C3D\C3D_RICK_NCS_2022\Resources\DEN\DEN_GENERAL.dwg"

 

 

EN-ARRW_2_COLOR

and 

ARV_RICK_Logo_EXHBIT

 

However, my LISP hangs at the end of each "-INSERTCONTENT". What am I missing? 

 

When I run it I can manually hit enter and it continues to the next "-INSERTCONTENT" command, then I hit enter again, and it completes. Its also not rotate the north arrow block correctly. I'm clearly missing a parameter or variable expected by the "-INSERTCONTENT" command. I tried reading up on it but the documentation is lacking in my opinion. I would love some guidance.

0 Likes
Accepted solutions (1)
605 Views
5 Replies
Replies (5)
Message 2 of 6

paullimapa
Mentor
Mentor
Accepted solution

the first command line seems to only require two returns at the end like this:

(command "-INSERTCONTENT" "C:\\Autodesk\\DEN_GENERAL.dwg" "DEN-ARRW_2_COLOR" (getvar "viewctr") "" "")

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 6

mspeace
Enthusiast
Enthusiast

ah yes, duh! I knew it was something silly. Now I just need to work out how to prevent the pop up about redefining the block. 

0 Likes
Message 4 of 6

paullimapa
Mentor
Mentor

@mspeace updated try this:

Note: BLOCKREDEFINEMODE variable with 2 settings was introduced in AutoCAD 2022

 

(if(tblsearch"BLOCK""DEN-ARRW_2_COLOR") ; chk if block exists
 (progn ; then do following
  (setq BLOCKREDEFINEMODE (getvar "BLOCKREDEFINEMODE"))
  (setvar "BLOCKREDEFINEMODE" 2)
  (command "-INSERTCONTENT" "C:\\Autodesk\\DEN_GENERAL.dwg" "DEN-ARRW_2_COLOR" "_Y" (getvar "viewctr") "" "")
  (setvar "BLOCKREDEFINEMODE" BLOCKREDEFINEMODE)
 )
 ; else just insertcontent
  (command "-INSERTCONTENT" "C:\\Autodesk\\DEN_GENERAL.dwg" "DEN-ARRW_2_COLOR" (getvar "viewctr") "" "")
)

 

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 6

mspeace
Enthusiast
Enthusiast

yeah I was considering a test for it. Thanks. 

0 Likes
Message 6 of 6

paullimapa
Mentor
Mentor

Looks like AutoCAD only prompts for redefinition if the inserted block actually changed. But if it did not then there would be no prompt. So unless you know for sure that the current inserted block is different, the extra "_Y" in there would cause the routine to fail.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes