AdamW Posted March 12, 2018 Share Posted March 12, 2018 I am trying to create a routine that allows me to select a dimension that then sets this as the current dimension style and also the current layer from the dimension selected. Code Below (defun C:SetDimLayer () (princ "\Select Desired Dimstyle...") (setq sg (ssget)) (command "-DIMSTYLE" "_R" sg) ;remove this line and line below works (command "laymcur" sg) ;remove this line and line above works (princ) ) I can get this to work with either of the command statements on their own but not with both command lines. Is there something that I am missing. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted March 12, 2018 Share Posted March 12, 2018 Try this quick code: (defun c:foo (/ e) (cond ((and (setq e (car (entsel "\nPick a dimension: "))) (= "DIMENSION" (cdr (assoc 0 (entget e))))) (setvar 'clayer (cdr (assoc 8 (entget e)))) (command "-dimstyle" "r" (cdr (assoc 3 (entget e)))) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
AdamW Posted March 13, 2018 Author Share Posted March 13, 2018 Many Thanks Ron. Jut got to work and tried it out and it works great. Can you tell me what the assoc values are or point me in the direction to find documentation. Im relatively new to new lisp. I have gained most my knowledge from a collegue at work and reverse engineering to see what things do. This assoc is new to me though Ta Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 13, 2018 Share Posted March 13, 2018 Autocad use dxf codes also known as association values, there is lots of full DXF code lists out there search here 1st. Its basicly the core data base identifying an object by a Unique key. a few common ones but note they can be a bit mixed and match depending on the type of object 10 insert pt, start pt line etc 11 end pt line etc 8 layer see above 0 object type see above 2 name The other thing to use is dumpit.lsp it will reveal a lot of the values and you can use VL-get & put functions re an object properties. ;;;===================================================================; ;;; DumpIt ; ;;;-------------------------------------------------------------------; ;;; Dump all methods and properties for selected objects ; ;;;===================================================================; (defun C:DumpIt ( / ent) (while (setq ent (entsel)) (vlax-Dump-Object (vlax-Ename->Vla-Object (car ent)) ) ) (princ) ) Command: DUMPIT Select object: ; IAcadDimRotated: AutoCAD Rotated Dimension Interface ; Property values: ; Measurement (RO) = 301.245 ; ObjectName (RO) = "AcDbRotatedDimension" ; StyleName = "DESIGN" Quote Link to comment Share on other sites More sharing options...
ronjonp Posted March 13, 2018 Share Posted March 13, 2018 HERE is the documentation from the help file too. Also, here is a quick function you can use to inspect items in your drawings. (defun c:dxf (/ e) (cond ((setq e (car (entsel "\nPick something to see DXF data: "))) (mapcar 'print (entget e '("*"))) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
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.