p7q Posted December 25, 2024 Posted December 25, 2024 (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 December 26, 2024 by SLW210 Added Code Tags! Quote
SLW210 Posted December 26, 2024 Posted December 26, 2024 Please use code tags for your code. (<> in the editor toolbar) 1 Quote
mhupp Posted December 26, 2024 Posted December 26, 2024 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) ) 1 Quote
BIGAL Posted December 27, 2024 Posted December 27, 2024 Maybe just try (command "dimstyle" "R" "yourdimstyle") before running Qdim. Not tested. 1 Quote
rlx Posted December 27, 2024 Posted December 27, 2024 or put them on temp layer first , then change style / layer. Not sexy but dragonproof. 2 Quote
Steven P Posted December 27, 2024 Posted December 27, 2024 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 Quote
p7q Posted December 27, 2024 Author Posted December 27, 2024 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 1 Quote
Recommended Posts
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.