Jump to content

How to automatically select items in a dialog via lisp


Recommended Posts

Posted

Hey everyone. I've been working on a lisp routine that alters the color of a selection set based on the values of slopes. one of the commands i issue in the routine is unique to civil 3D. The command is called moveblockstosurface. When its initiated, a dialog box pops up that lists all the blocks in the drawing, as well as an OK and a cancel box (see image). I am wondering whether there is a way to automatically select the items i want in this menu via lisp routine?

image.png

Posted

Since AutoLISP does not permit multiple threads, the dialog will take focus and cause evaluation of the AutoLISP program to 'pause' until the dialog is dismissed (think of the operations as being performed in 'series' as opposed to in 'parallel'); as such, it is not possible to interact with the dialog using AutoLISP, as any code present following the invocation of the dialog will be evaluated after the dialog has already been dismissed.

Posted
15 minutes ago, Lee Mac said:

Since AutoLISP does not permit multiple threads, the dialog will take focus and cause evaluation of the AutoLISP program to 'pause' until the dialog is dismissed (think of the operations as being performed in 'series' as opposed to in 'parallel'); as such, it is not possible to interact with the dialog using AutoLISP, as any code present following the invocation of the dialog will be evaluated after the dialog has already been dismissed.

It sounds like I'll have to write my own version of moveblockstosurface then. One that takes the blocks whose name never changes, then moves them to the surface that they share space with. Any pointers on this?

 

I'm thinking... 

-Filter a selection set to contain the blocks i want

-set the elevation data for the blocks to that of the point on a surface that matches the same x,y coordinate pair

Posted (edited)

Getting inside CIV3D is not easy yes using the blocks insert point and making a point on the surface may be the way to go. 

 

 

(defun c:test ( / pt)
(repeat for blocks
;(setvar 'clayer "Dummy")
(command "_AeccCreatePointRandomPoints")
(while (setq pt (getpoint "pickpoint")) ; replace with block insertion pt
(command pt "random")
; this is where do move block reset Z get entlast
)
(command "")
)

; delete all cogo points on layer "dummy"
)

You may have to do 1 point at a time closing the create command. Then do move block by changing Z value of insertion point. Need to use CMDACTIVE this lets you do other stuff inside a command like change Z. Need a bit of time.

 

 

Edited by BIGAL
Posted
17 hours ago, BIGAL said:

Getting inside CIV3D is not easy yes using the blocks insert point and making a point on the surface may be the way to go. 

 

 


(defun c:test ( / pt)
(repeat for blocks
;(setvar 'clayer "Dummy")
(command "_AeccCreatePointRandomPoints")
(while (setq pt (getpoint "pickpoint")) ; replace with block insertion pt
(command pt "random")
; this is where do move block reset Z get entlast
)
(command "")
)

; delete all cogo points on layer "dummy"
)

You may have to do 1 point at a time closing the create command. Then do move block by changing Z value of insertion point. Need to use CMDACTIVE this lets you do other stuff inside a command like change Z. Need a bit of time.

 

 


So i need to be moving the points already present on the drawing, rather than creating new points on the surface because the blocks that contain the points in them reference the specific points inside of them for calculations. Basically what I have is a block that contains a rectangle, and 4 points (one at each corner). the rectangle is a block with an attribute that calculates the slope between each pair of corners. in order to make this work i had to reference the specific point in the attribute field. case being I need to move the points that are already present to the surface. 

 

Do you know what a surface is stored as DXF-wise? am i able to access coordinate pairs and retrieve z-data from specific coordinate pairs?

Posted

In civ3d there is a slope label option this may be a better way to go.

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