Jump to content

Create Dimension Style Using Visual Lisp?


ksperopoulos

Recommended Posts

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • ksperopoulos

    12

  • Lee Mac

    7

  • BIGAL

    2

  • Costinbos77

    2

Top Posters In This Topic

Posted Images

Unless I missed it, what is the opposition to just creating it using plain autolisp?

Just curious.

 

  1. I am still learning and I like to see what my options are.:book:
  2. I am borderline OCD, so I like my code to look the same as much as possible.:wacko:
  3. Like I mentioned before, I think it is easier to read for me to see what I have done (especially for a novice like me).;)

Link to comment
Share on other sites

To throw another option into the mix, you could also import the Dimension Style from a template/supporting drawing using ObjectDBX - no configuration necessary.

 

I actually thought of doing that Lee, but I wanted to stay with something a little more "basic" for me. I'm sure getting something from another file is not as complicated as I think, but I want to get the hang of working within the files first. Maybe later, I will venture outside.

Link to comment
Share on other sites

I actually thought of doing that Lee, but I wanted to stay with something a little more "basic" for me. I'm sure getting something from another file is not as complicated as I think, but I want to get the hang of working within the files first. Maybe later, I will venture outside.

 

ObjectDBX may be a cleaner approach, as you can control exactly which objects are imported (here is an existing solution if you wish to follow this route); but since you presumably have full control over the content of the template file, an even easier method would be to simply import the block definition of the template file (command "_.-insert" nil) and hence import the Dimension Style in the process, and then delete the block definition.

Link to comment
Share on other sites

  • 4 years later...

Hi, 

 

following the above codes as :

 (if (tblSearch "DimStyle" n)
  (prinC (strCat "\n   Dimension  Style  '" n "'  ,   Already  EXIST   ;"))
  (progn
   (prinC (strCat "\n   Define  NEW  Dimension  Style  :  '" n "'  ;"))
   (or ActDoc (setq ActDoc (vla-Get-ActiveDocument (vlax-Get-Acad-Object)) ) ) ; or
   (setq dimC (vla-Get-DimStyles ActDoc))
   (setq dS (vla-Add (vla-Get-DimStyles (vla-Get-ActiveDocument (vlax-Get-Acad-Object))) n))
   (vla-Put-ActiveDimStyle ActDoc dS)
;;;   (vla-SetVariable ActDoc "Variable" "VariableValue")
   (forEach e (list
    (list "DimAdec" zU) ; 4
    (list "DimAlt" 0)
    (list "DimAltD" 2)
    (list "DimAltF" 25.4)
    (list "DimAltRnd" 0.)
    (list "DimAltTD" 2)
    (list "DimAltTZ" 0)
    (list "DimAltU" 2)
    (list "DimAltZ" 0)
; read-only - DIMANNO 0
    (list "DimApost" "")
    (list "DimARCSYM" 0)
    (list "DimAssoc" 2)
    (list "DimASZ" 0.18)
    (list "DimATFIT" 3)
    (list "DimAunit" 0)
    (list "DimAzin" 0)
    (list "DimBlk" b) ; "Oblique" "ArchTick"
    (list "DimBlk1" "")
    (list "DimBlk2" "")
    (list "DimCEN" 0.09)
    (list "DimClrD" cD) ; Culoare Linii Dimension
    (list "DimClrE" cE) ; Culoare Linii Extensii
    (list "DimClrT" cT) ; Culoare Text 0-256
    (list "DimConstraintIcon" 3)
    (list "DimContinueMode" 1)
    (list "DimDec" zD) ; 3
    (list "DimDLE" 0.)
    (list "DimDLI" 0.38)
;;;    (list "DimDsep" '(0. 0.))
    (list "DimExe" 0.18)
    (list "DimExo" 0.0625)
    (list "DimFRAC" 0)
    (list "DimFXL" 1.)
    (list "DimFXLON" 0)
    (list "DimGAP" 0.09)
    (list "DimJOGANG" 0.7854)
    (list "DimJust" 0)
    (list "DimLAYER" ".") ; separator
    (list "DimLdrBlk" "")
    (list "DimLfac" sF) ; 1.
    (list "DimLim" 0)
;;;    (list "DimLtex1" "")
;;;    (list "DimLtex2" "")
;;;    (list "DimLtype" "")
    (list "DimLunit" u) ; 2 = Decimal
    (list "DimLwd" -2)
    (list "DimLwe" -2)
    (list "DimPickBox" 5)
    (list "DimPost" (strCat p "<>" s))
    (list "DimRnd" 0.)
    (list "DimSAH" 0)
    (list "DimScale" 1.)
    (list "DimSD1" 0)
    (list "DimSD2" 0)
    (list "DimSE1" 0)
    (list "DimSE2" 0)
    (list "DimSOXD" 0)
; read-only - DIMSTYLE "Standard"
    (list "DimTAD" 0)
    (list "DimTdec" 3) ; Toleranta Decimals
    (list "DimTfac" 1.) ; Toleranta SF
    (list "DimTfill" 0)
    (list "DimTfillCLR" 0)
    (list "DimTih" 0)
    (list "DimTix" 0)
    (list "DimTm" 0.)
    (list "DimTmove" 0)
    (list "DimTOFL" 0)
    (list "DimTOH" 0)
    (list "DimTOL" 0)
    (list "DimTOLJ" 1)
    (list "DimTP" 0.)
    (list "DimTSZ" 0.)
    (list "DimTVP" 0.)
    (list "DimTxSty" tS) ; "Standard"
    (list "DimTxt" h) ; 0.18
    (list "DimTxtDirection" r) ; 0
    (list "DimTxtRuler" 1)
    (list "DimTzin" 0)
    (list "DimUPT" 0)
    (list "DimZin" 0)
    )
    (if (getVar (setq prop (car e))) (setVar prop (cadr e)) (prinC (strCat "\n   UnAvailable  Property  Variable  :  '" prop "'  ;")) )
   ) ; f
   (vla-CopyFrom dS dimC)
   

 

1. What action can cose to disapear 'Standard' Dimension Style as in the below picture ?

Dim1.jpg.4242d25b81fd7ca32336eb1d21deced2.jpg

 

2. 'Purge' command can remove it ?

(command "_.-Purge" "_B" "*" "_N")

Used separate , as a user Function how it is in this post , it is working fine , but , calling the Function in a program is removing the 'Standard' Dimension Style .

 

3. Why it is like that and  How can be changed the description of the Dimension style 'Test1 + Angle precision = 0'?

 

Regards ,

Costin

Edited by Costinbos77
Link to comment
Share on other sites

Hi ,

 

I find something very interesting about the 'Purge' command in releation with Dimension styles .

 

So , in a NEW drawing , with NO entities , I copied and renamed the 'Standard' dimension style into 'Test1' and make it the current one .

 

Writing from keyboard 'Purge' :

1432725998_Purge0.jpg.3dc23d58a581d2786a84eb9c71b3a26b.jpg

 

the AutoCAD program is launching a dialog window :

1515968931_Purge1.jpg.8252539f286ecd40bfb134c2be9e7bd8.jpg

 

which cannot remove the "Standard" dimension style (which was not used / attached to an object and is not the current one ) .

 

But , the command '-Purge' :

(command "_.-Purge" "_A" "" "_N")

can do it !

1603774737_Purge2.thumb.jpg.f9fbe94664b0221a5f0d4d338a8f67d9.jpg

 

Hmm ... 🤔

 

Regards,

Costin

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