+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24
  1. #1
    Senior Member ksperopoulos's Avatar
    Computer Details
    ksperopoulos's Computer Details
    Operating System:
    Windows 8.1 Enterprise; 64-bit
    Computer:
    HP Elitebook 8760w
    RAM:
    16GB
    Graphics:
    NVIDIA Quadro 4000M
    Using
    AutoCAD 2016
    Join Date
    Feb 2009
    Location
    Kansas City, MO
    Posts
    438

    Default Create Dimension Style Using Visual Lisp?

    Registered forum members do not see this ad.

    Is there a way to create a dimension style via Visual LISP instead of AutoLISP? It seems like the only way I can find is by setting variables instead of properties (similar to how one can with layers, text styles, etc.).
    Kyle

    AutoCad MEP 2016; Fabrication CADmep 2016; Navisworks Manage 2016; Revit 2016
    HP Elitebook 8760w; Windows 8.1 Enterprise; 64-bit; 16GB RAM; NVIDIA Quadro 4000M

  2. #2
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,085

    Default

    Hi,
    An abstract example.

    Code:
    (vla-add (vla-get-dimstyles (vla-get-activedocument (vlax-get-acad-object))) "New Dim")

  3. #3
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,362

    Default

    The Visual LISP route will still involve configuring system variables and then using the copyfrom method.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  4. #4
    Senior Member ksperopoulos's Avatar
    Computer Details
    ksperopoulos's Computer Details
    Operating System:
    Windows 8.1 Enterprise; 64-bit
    Computer:
    HP Elitebook 8760w
    RAM:
    16GB
    Graphics:
    NVIDIA Quadro 4000M
    Using
    AutoCAD 2016
    Join Date
    Feb 2009
    Location
    Kansas City, MO
    Posts
    438

    Default

    Thank you for your response. I should have been more clear. I already have been able to add the style to the collection via vla-add, I am more interested though in setting the properties associated with the style.
    Kyle

    AutoCad MEP 2016; Fabrication CADmep 2016; Navisworks Manage 2016; Revit 2016
    HP Elitebook 8760w; Windows 8.1 Enterprise; 64-bit; 16GB RAM; NVIDIA Quadro 4000M

  5. #5
    Senior Member ksperopoulos's Avatar
    Computer Details
    ksperopoulos's Computer Details
    Operating System:
    Windows 8.1 Enterprise; 64-bit
    Computer:
    HP Elitebook 8760w
    RAM:
    16GB
    Graphics:
    NVIDIA Quadro 4000M
    Using
    AutoCAD 2016
    Join Date
    Feb 2009
    Location
    Kansas City, MO
    Posts
    438

    Default

    Quote Originally Posted by Lee Mac View Post
    The Visual LISP route will still involve configuring system variables and then using the copyfrom method.
    Thank you Lee. That's what I thought. I just wanted to make sure I was headed down the right path if I chose to go with VL.
    Kyle

    AutoCad MEP 2016; Fabrication CADmep 2016; Navisworks Manage 2016; Revit 2016
    HP Elitebook 8760w; Windows 8.1 Enterprise; 64-bit; 16GB RAM; NVIDIA Quadro 4000M

  6. #6
    Senior Member ksperopoulos's Avatar
    Computer Details
    ksperopoulos's Computer Details
    Operating System:
    Windows 8.1 Enterprise; 64-bit
    Computer:
    HP Elitebook 8760w
    RAM:
    16GB
    Graphics:
    NVIDIA Quadro 4000M
    Using
    AutoCAD 2016
    Join Date
    Feb 2009
    Location
    Kansas City, MO
    Posts
    438

    Default

    I placed a dimensions using my dimension style in a drawing. I then did a vlax-dump-object on that it to see what it returned. I came up with a long list of information that seems like I would be able to use for creating the dimstyle. Can these properties be applied to a dimstyle or can they only be applied to an existing dimension in a drawing?

    Code:
    ; IAcadDimRotated: AutoCAD Rotated Dimension Interface
    ; Property values:
    ;   AltRoundDistance = 0.0
    ;   AltSubUnitsFactor = 100.0
    ;   AltSubUnitsSuffix = ""
    ;   AltSuppressLeadingZeros = 0
    ;   AltSuppressTrailingZeros = 0
    ;   AltSuppressZeroFeet = -1
    ;   AltSuppressZeroInches = -1
    ;   AltTextPrefix = ""
    ;   AltTextSuffix = ""
    ;   AltTolerancePrecision = 2
    ;   AltToleranceSuppressLeadingZeros = 0
    ;   AltToleranceSuppressTrailingZeros = 0
    ;   AltToleranceSuppressZeroFeet = -1
    ;   AltToleranceSuppressZeroInches = -1
    ;   AltUnits = 0
    ;   AltUnitsFormat = 2
    ;   AltUnitsPrecision = 2
    ;   AltUnitsScale = 25.4
    ;   Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff7b8dfa130>
    ;   Arrowhead1Block = "ArchTick"
    ;   Arrowhead1Type = 4
    ;   Arrowhead2Block = "ArchTick"
    ;   Arrowhead2Type = 4
    ;   ArrowheadSize = 0.09375
    ;   DecimalSeparator = "."
    ;   DimConstrDesc = Exception occurred
    ;   DimConstrExpression = Exception occurred
    ;   DimConstrForm = 0
    ;   DimConstrName = Exception occurred
    ;   DimConstrReference = 0
    ;   DimConstrValue = Exception occurred
    ;   DimensionLineColor = 256
    ;   DimensionLineExtend = 0.0625
    ;   DimensionLinetype = "Continuous"
    ;   DimensionLineWeight = 25
    ;   DimLine1Suppress = 0
    ;   DimLine2Suppress = 0
    ;   DimLineInside = 0
    ;   DimTxtDirection = 0
    ;   Document (RO) = #<VLA-OBJECT IAcadDocument 000000bfffb0abd8>
    ;   EntityTransparency = "ByLayer"
    ;   ExtensionLineColor = 256
    ;   ExtensionLineExtend = 0.0625
    ;   ExtensionLineOffset = 0.0625
    ;   ExtensionLineWeight = 25
    ;   ExtLine1Linetype = "Continuous"
    ;   ExtLine1Suppress = 0
    ;   ExtLine2Linetype = "Continuous"
    ;   ExtLine2Suppress = 0
    ;   ExtLineFixedLen = 1.0
    ;   ExtLineFixedLenSuppress = 0
    ;   Fit = 3
    ;   ForceLineInside = 0
    ;   FractionFormat = 2
    ;   Handle (RO) = "A73B"
    ;   HasExtensionDictionary (RO) = -1
    ;   HorizontalTextPosition = 0
    ;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000bfaf276a38>
    ;   Layer = "0"
    ;   LinearScaleFactor = 1.0
    ;   Linetype = "ByLayer"
    ;   LinetypeScale = 1.0
    ;   Lineweight = -1
    ;   Material = "ByLayer"
    ;   Measurement (RO) = 940.458
    ;   Normal = (0.0 0.0 1.0)
    ;   ObjectID (RO) = 42
    ;   ObjectName (RO) = "AcDbRotatedDimension"
    ;   OwnerID (RO) = 43
    ;   PlotStyleName = "ByLayer"
    ;   PrimaryUnitsPrecision = 3
    ;   Rotation = 0.0
    ;   RoundDistance = 0.0
    ;   ScaleFactor = 1.0
    ;   StyleName = "MMC"
    ;   SubUnitsFactor = 100.0
    ;   SubUnitsSuffix = ""
    ;   SuppressLeadingZeros = 0
    ;   SuppressTrailingZeros = 0
    ;   SuppressZeroFeet = -1
    ;   SuppressZeroInches = 0
    ;   TextColor = 256
    ;   TextFill = 0
    ;   TextFillColor = 0
    ;   TextGap = 0.0625
    ;   TextHeight = 0.09375
    ;   TextInside = 0
    ;   TextInsideAlign = 0
    ;   TextMovement = 0
    ;   TextOutsideAlign = 0
    ;   TextOverride = ""
    ;   TextPosition = (-1843.13 1512.41 0.0)
    ;   TextPrefix = ""
    ;   TextRotation = 0.0
    ;   TextStyle = "MMC"
    ;   TextSuffix = ""
    ;   ToleranceDisplay = 0
    ;   ToleranceHeightScale = 1.0
    ;   ToleranceJustification = 1
    ;   ToleranceLowerLimit = 0.0
    ;   TolerancePrecision = 3
    ;   ToleranceSuppressLeadingZeros = 0
    ;   ToleranceSuppressTrailingZeros = 0
    ;   ToleranceSuppressZeroFeet = -1
    ;   ToleranceSuppressZeroInches = -1
    ;   ToleranceUpperLimit = 0.0
    ;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000bfb5b704e0>
    ;   UnitsFormat = 4
    ;   VerticalTextPosition = 1
    ;   Visible = -1
    Kyle

    AutoCad MEP 2016; Fabrication CADmep 2016; Navisworks Manage 2016; Revit 2016
    HP Elitebook 8760w; Windows 8.1 Enterprise; 64-bit; 16GB RAM; NVIDIA Quadro 4000M

  7. #7
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,882

    Default

    Had a quick look at my R12 lisp manual the paper one and there is close to 2 pages of dxf codes for making a dimstyle, so yes you should be able to change either 1 dim or alter a dimstyle. Tharwats code opens up the dim styles just need next step to get at each one I was doing something wrong when trying a dump.
    A man who never made mistakes never made anything

  8. #8
    Senior Member ksperopoulos's Avatar
    Computer Details
    ksperopoulos's Computer Details
    Operating System:
    Windows 8.1 Enterprise; 64-bit
    Computer:
    HP Elitebook 8760w
    RAM:
    16GB
    Graphics:
    NVIDIA Quadro 4000M
    Using
    AutoCAD 2016
    Join Date
    Feb 2009
    Location
    Kansas City, MO
    Posts
    438

    Default

    You may not have been doing anything wrong when you tried dumping the dimstyle. If you dump an existing dimstyle object or the dimstyle object added to the collection per the code Tharwat is demonstrating, you only get a little information returned. If you set the variables like Lee mentions above, that is how you can edit all the settings of a dimstyle. Just out of curiosity, I thought I would place a dimension in my drawing and do a dump on the entity. The above list is what is returned. I was hoping these might provide another avenue of modifying a dimension style.
    Kyle

    AutoCad MEP 2016; Fabrication CADmep 2016; Navisworks Manage 2016; Revit 2016
    HP Elitebook 8760w; Windows 8.1 Enterprise; 64-bit; 16GB RAM; NVIDIA Quadro 4000M

  9. #9
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,882

    Default

    Getting their slowly a bit of a google you can only edit the current dimstyle so use copyfrom then set properties, which is what Lee was suggesting

    Code:
    (setq dims (vla-get-activedimstyle (vla-get-activedocument (vlax-get-acad-object))))
    (vla-put-name dims "BIGAL") ; renames your current dim style
    ; just use what you dumped above
    A man who never made mistakes never made anything

  10. #10
    Senior Member ksperopoulos's Avatar
    Computer Details
    ksperopoulos's Computer Details
    Operating System:
    Windows 8.1 Enterprise; 64-bit
    Computer:
    HP Elitebook 8760w
    RAM:
    16GB
    Graphics:
    NVIDIA Quadro 4000M
    Using
    AutoCAD 2016
    Join Date
    Feb 2009
    Location
    Kansas City, MO
    Posts
    438

    Default

    Registered forum members do not see this ad.

    I think you, Lee, and I are all saying the same thing, but I was just looking at a different way of writing the code. I really like how easy it is to read visual lisp code. It may use longer function names, property names, etc., but when reading it, I can figure out what I did a lot quicker. So I was looking to incorporate this method with creating a dimension style from scratch. I now understand that you can only modify the properties of the current dimension style. I also understand that those properties can only be modified by setting each individual variable similar to this:

    Code:
    (vla-setvariable doc "DIMCLRD" 256)
    However, I was hoping to do something more along the lines of this:

    Code:
    (vlax-put-property dimobj "DimensionLineColor" 256)
    Kyle

    AutoCad MEP 2016; Fabrication CADmep 2016; Navisworks Manage 2016; Revit 2016
    HP Elitebook 8760w; Windows 8.1 Enterprise; 64-bit; 16GB RAM; NVIDIA Quadro 4000M

Similar Threads

  1. Need help !Use lisp Create text style & dimension style.
    By lucas3 in forum AutoLISP, Visual LISP & DCL
    Replies: 26
    Last Post: 18th Jan 2014, 05:53 pm
  2. How to create a text style for a dimension
    By AutoCAD Tips Blog in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 6th Aug 2011, 05:30 pm
  3. dimension style create (plz chk my new lisp & how to improve)
    By autolisp in forum AutoLISP, Visual LISP & DCL
    Replies: 37
    Last Post: 31st Jul 2010, 08:01 am
  4. Tutorial: Create a visual style
    By AutoCAD Tips Blog in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 21st Oct 2007, 07:42 pm
  5. Tutorial: Create a custom visual style in AutoCAD 2007
    By AutoCAD Tips Blog in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 13th Nov 2006, 09:50 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts