Jump to content

"How to Collect All Dimensions Created by QDIM into a List in AutoLISP?


Recommended Posts

Posted (edited)

Hi everyone,

I’m working on an AutoLISP routine to dimension the distances between a group of objects. My goal is to ensure that all the dimensions created use a specific DimStyle that I define. Since the QDIM command doesn’t provide a way to set the DimStyle directly, I decided to modify the dimensions after they are created.

Right now, I’m using entlast to capture the dimensions and update their DimStyle. However, the problem is that entlast only retrieves the last created object, meaning I miss most of the dimensions created during the QDIM operation.

I’m looking for a reliable method to:

Capture all dimensions created by the QDIM command.

Apply my custom DimStyle to those dimensions.

Here’s a simplified version of what I’m trying to do:

(if (checkList MyList)
  (progn
    (command "_.QDIM")
    (foreach obj MyList (command obj))
    (command "")
    (command MyPoint)
    (setq lastdimm (entlast))
     (fixDimStyle lastdimm dimstyle)
     (setq dimList (cons lastdimm dimList))
  )
)

Has anyone dealt with a similar issue, or does anyone have suggestions or alternative approaches to achieve this? 

Edited by SLW210
Added Code Tags!
Posted

Please use code tags for your code. (<> in the editor toolbar)

  • Thanks 1
Posted

This is what I use to add items to a selection set

 

(setq ss ssadd) ;need at least a blank selection set to add things
(setq LastEnt (entlast)) ;set this before you create or modify anything in the drawing.
... do stuff
(while (setq LastEnt (entnext LastEnt)) ;this will add anything created after lastent was set to selection set ss
  (ssadd LastEnt SS)
)

 

  • Like 1
Posted

Maybe just try (command "dimstyle" "R" "yourdimstyle") before running Qdim. Not tested.

  • Like 1
Posted

or put them on temp layer first , then change style / layer. Not sexy but dragonproof.

  • Like 2
Posted

Not sure if this would need to be a multi-step process or as a singe LISP. Set a global variable to (entlast) before doing any dims, add the dimensions as required and 3rd stage (entnext) till the last entity, if entity = dim then set the style

Posted
14 hours ago, mhupp said:

This is what I use to add items to a selection set

 

(setq ss ssadd) ;need at least a blank selection set to add things
(setq LastEnt (entlast)) ;set this before you create or modify anything in the drawing.
... do stuff
(while (setq LastEnt (entnext LastEnt)) ;this will add anything created after lastent was set to selection set ss
  (ssadd LastEnt SS)
)

 

Its worked as ı wanted , Thank you mhupp

  • Like 1

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