Jump to content

LISP Program Renders Existing Blockreferences Undefined


LialAtArnold

Recommended Posts

I have a C# application that calls a LISP program to insert blocks into a drawing. When I run this LISP program from the C# interface it renders all existing blocks with the same name as: ** Undefined block #2129780480

 

The process is:

1. I use the INSERT command from the command line to place a block called REVISION in the drawing.

2. I then run the C# application which calls the LISP program that inserts the same block (REVISION).

3. The block reference inserted from the command line becomes undefined.

 

The code I use to call the LISP program is:

//Get a reference to the active document

Document doc = AcadApp.DocumentManager.MdiActiveDocument;

//Convert the document to an Interop version

AcadDocument curAcadDoc = (AcadDocument)doc.AcadDocument;

 

//Send the Visual LISP Load Command to the editor

curAcadDoc.SendCommand("(vl-load-com) "/*space after closing paren!!!*/);

//Which size Titleblock is being used (D or F)

if (TitleBlockSize.Equals("D"))

{

//D Size Standard Width Device List

if (this.radioButton1.Checked)

{

//Set up the full path to the LISP program

string lispPath = "Z:/NPID16/HCAD/DLIST20";

 

//Format the string to load the specified LISP program

string loadStr = String.Format("(vl-load-all \"{0}\") "/*space after closing paren!!!*/, lispPath);

 

//Send the formatted command to the editor

curAcadDoc.SendCommand(loadStr);

 

//Now call the LISP program

curAcadDoc.SendCommand("_DLIST20 ");

}

}

 

If I load and run the LISP program outside the C# application there are no problems.

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...