Jump to content

Recommended Posts

Posted

Some one may be able to help I am stuck, the depth of CIV3d sometimes can be a nightmare when modifying styles. We have around 500 layers unfortunately they were set up by our dealer trying to find the style that uses that layer is a nightmare.

 

So 1st request really dont expect can be done find the name of the style with a specific layer name.

 

If that does not work please look at this can not get to next level linelablestyles.

 

(vl-load-com)
(load "getver") ; returns *AeccDoc*
(AH:getver)
(setq Align_label_styles (vlax-get *AeccDoc* 'AlignmentlStyles)) 
(setq lblstyl1 (vlax-get Align_label_styles 'Linelablestyles))
; or this (setq lblstyl1 (vlax-get-property Align_label_styles 'item "Linelablestyles"))

; Command: (vlax-dump-object Align_label_styles T)
; IAeccAlignmentLabelStyles: IAeccAlignmentLabelStyles Interface
; Property values:
;   CurveLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 000000003078cbf8>
;   DesignSpeedLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 0000000030787ef8>
;   GeometryPointLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 0000000030788738>
;   LineLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 0000000030781938>
;   MajorStationLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 000000003078cc38>
;   MinorStationLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 0000000030781838>
;   SpiralLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 0000000030788538>
;   StationEquationLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 0000000030786238>
;   StationOffsetLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 0000000030785738>
;   TangentIntersectionLabelStyles (RO) = #<VLA-OBJECT IAeccLabelStyles 00000000307852b8>

 

 

ScreenShot021.jpg

Posted

BIGAL (RO)= Read only! no luck :shock:

not sure .NET can help?

Posted

Just the parent is read-only. Maybe the following code will help you.

 

;Get the Alignment Label Styles
(setq als (vlax-get-property *AeccDoc* 'AlignmentLabelStyles))

;Get the Line Label Styles
(setq lls (vlax-get-property als 'LineLabelStyles))

;Get the Style
(setq style (vlax-get-property lls 'Item 0))

;Get the Label Properties
(setq lp (vlax-get-property style 'LabelProperties))

;Get the Aecc Layer Properties
(setq lay (vlax-get-property lp 'Layer))

;Get the Name of the Layer
(setq layname (vlax-get-property lay 'Value))

Posted

Thanks will try as soon as I get to work having problems with my CIV3d at home getting automation error message when I run this (vla-getinterfaceobject (vlax-get-acad-object) "AeccXUiLand.AeccApplication.10.0" ) will probably reload completely.

Posted

BIGAL

 

Not only was I able to read the value of 'Value I was able to change it as well.

 

(vlax-put-property lay 'Value "some-layer-name-that-exists")

Posted

Yeah thats what I intend to do make a paired list (lable layer) as you say if you can get it you can generally put it. It about changing the DWT we have around 500 labels with som lable styles having up to 4 lables were one layer would do xxx-line xxx-arc xxx-text

Posted

Now that would be really useful. I just recently started using C3D [the situtation calls for it], never thought about using lisp to modify the numerous "styles" C3D had to offer. You may have something there BIGAL, I'll subscribe to this thread and see how it goes.

Posted

Our dwt was very extensive but maybe a bit over the top with every combo a different layer with the styles c-dsgn-major, c-dsgn-major-lbl, then minor so 4 layers.

 

You can remove unused styles but then you can get caught out if you do something, same with blocks as they are linked to styles.

Posted
Just the parent is read-only. Maybe the following code will help you.

 

Thanks for clarify.

Though not c3d user, the concept is applicable.

BIGAL is lucky because of HipPe013 no luck with HanhPhuc :)

Posted

Getting there now will make a csv file of output so can sort etc, need to set up repeat loops then do all again, one question 'AlignmentLabelStyles whilst I can get their names via dump again struggling to return these as a variable. Eventually will do points also.

 

(load "vercheck")
(AH:vercheck)
;Get the Alignment Label Styles
(setq als (vlax-get-property *AeccDoc* 'AlignmentLabelStyles))
; Property values:
;   CurveLabelStyles
;   DesignSpeedLabelStyles 
;   GeometryPointLabelStyles >
;   LineLabelStyles 
;   MajorStationLabelStyles 
;   MinorStationLabelStyles 
;   SpiralLabelStyles 
;   StationEquationLabelStyles 
;   StationOffsetLabelStyles 
;   TangentIntersectionLabelStyles 
;Get the Line Label Styles
(setq lls (vlax-get-property als 'LineLabelStyles))
; (vla-get-count lls)  ; is how many style names
;Get the Style
(setq style (vlax-get-property lls 'Item 0))  ; count is number of styles start at 0
; (vla-get-Name style) is style name
;Get the Label Properties
(setq lp (vlax-get-property style 'LabelProperties))
;Get the Aecc Layer Properties
(setq lay (vlax-get-property lp 'Layer))
;Get the Name of the Layer
(setq layname (vlax-get-property lay 'Value))

Posted

Started on points slight different method as Point styles start at higher level.

 

I will post alignment code tomorrow and probably a start on points. Its a case of using Vlax-dump-object to get next level info.

Posted

Here is a start, I have now jumped to points, what I will do is provide a code sample but will provide a Word.doc with the sub entities highlighted via VLAX-DUMP so you can see down the tree and add any "Components" settings that you may want to customise, I need to do this as point styles with say 8 components and around 6+ items = 48+ variables. Maybe even code in a tree pasting into Autocad DWG. One thing I have come across is using blocks in label styles a problem with rescaling meant changing 8 components. See below

 

(defun getstyleinfo (count stname / stylname lp lay layname)
;Get the Style info and write out
(setq x 0)
(repeat count
(setq style (vlax-get-property lls 'Item x))  ; count is number of styles start at 0
(setq stylname (vla-get-Name style)); is style name
;Get the Label Properties
(setq lp (vlax-get-property style 'LabelProperties))
;Get the Aecc Layer Properties
(setq lay (vlax-get-property lp 'Layer))
;Get the Name of the Layer
(setq layname (vlax-get-property lay 'Value))
(write-line (strcat stname "," stylname "," layname) fo)
(setq x (+ x 1))
)
)
(load "vercheck")
(AH:vercheck)
;Get the Alignment Label Styles
(setq als (vlax-get-property *AeccDoc* 'AlignmentLabelStyles))
; Property values:
;   CurveLabelStyles
;   DesignSpeedLabelStyles 
;   GeometryPointLabelStyles 
;   LineLabelStyles 
;   MajorStationLabelStyles 
;   MinorStationLabelStyles 
;   SpiralLabelStyles 
;   StationEquationLabelStyles 
;   StationOffsetLabelStyles 
;   TangentIntersectionLabelStyles 

(setq fo (open "c:\\temp\\aligns2.lst" "W"))

;Get the Line Label Styles
(setq stname "CurveLabelStyles")
(setq lls (vlax-get-property als 'CurveLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)
(setq stname "DesignSpeedLabelStyles")
(setq lls (vlax-get-property als 'DesignSpeedLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)
(setq stname "GeometryPointLabelStyles")
(setq lls (vlax-get-property als 'GeometryPointLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)
(setq stname "LineLabelStyles")
(setq lls (vlax-get-property als 'LineLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)
(setq stname "MajorStationLabelStyles")
(setq lls (vlax-get-property als 'MajorStationLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)
(setq stname "CurveLabelStyles")
(setq lls (vlax-get-property als 'CurveLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)
(setq stname "MinorStationLabelStyles")
(setq lls (vlax-get-property als 'MinorStationLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)
(setq stname "SpiralLabelStyles")
(setq lls (vlax-get-property als 'SpiralLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)
(setq stname "StationEquationLabelStyles")
(setq lls (vlax-get-property als 'StationEquationLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)
(setq stname "TangentIntersectionLabelStyles")
(setq lls (vlax-get-property als 'TangentIntersectionLabelStyles))
(setq count (vla-get-count lls))  ; is how many style names
(getstyleinfo count stname)

(close fo)
(princ)

 

img-218115827-0001.pdf

  • Like 1
Posted

Bigal,

 

I like the intention of what you are trying to do here. I too, struggle with finding what style is using a particular layer. Though, I would have imagined the approach to be slightly different.

 

I imagined a function that would return all styles (style names) that use a given layer name. Then iterate through all the styles and return the styles that use that particular layer. I would also check the 'Object Layers' to see if the layer was also used there. I can also imagine a function that does the same thing except that it would be looking for what styles use a particular block.

 

Is this, in a sense, what you are trying to accomplish?

 

regards,

 

hippe013

Posted

Hippe013 your on track we want to clean up our template and remove some of the over zealousness in the layer naming and management.

 

The end result would be a csv file which we could add the change to and rerun the opposite to update numerous values. Possibly adding more catorgories such as text style colour etc.

 

The 3rd part is to dump to excel and use it to create new styles by copying and modifying.

 

The point stuff is coming its a bit time consuming.

Posted

A bit more, doing some research found some nice links over at AUGI forums by Blackbox regarding commercial software available that does a nice job of a layer name and how many styles using it. For moment will just go down csv and use excel to sort count etc Ultimate is to reverse process and PUT csv+new layer name, back into styles, Then work on more aspects like scaling predefined lable styles.

 

Anyone if you create a point style this case TBM ie x y z D in a box using a block, I can not find any global scaling factor but PROPERTIES refers to X-Y scale ? If you change the rotation angle it works :o

 


;(defun getstyleinfo ( / count ptstys stylname lp lay layname)
;Get the Style info and write out
(if (not AH:vercheck) (load "vercheck"))
(AH:vercheck)

;(setq fo (open "c:\\temp\\aligns2.lst" "W"))
Alignment Label Styles
(setq ptstys (vlax-get-property *AeccDoc* 'PointLabelStyles))
(setq count (vla-get-count ptstys))  ; is how many style names

(setq lblstyl1 (vlax-get-property Ptstys 'item 0)) ; gets the first lable style use repeat to walk through item x
; Property values a dump of lblsty1
;   Application (RO) = #<VLA-OBJECT IAeccApplication 000000002fcff590>
;   BlockComponents (RO) = #<VLA-OBJECT IAeccLabelStyleBlockComponents 000000002fcfecc0>
;   Children (RO) = #<VLA-OBJECT IAeccLabelStyles 000000002fceb588>
;   CreatedBy = "autodesk"
;   DateCreated (RO) = "21/08/2004 12:50:58 AM"
;   DateModified (RO) = "18/06/2007 5:31:48 PM"
;   Descendants (RO) = #<VLA-OBJECT IAeccLabelStyles 000000002fceaec8>
;   Description = "Point Number"
;   DirectionArrowComponents (RO) = #<VLA-OBJECT IAeccLabelStyleDirectionArrowComponents 000000002fcff080>
;   Document (RO) = #<VLA-OBJECT IAeccDocument 000000002fcfeb10>
;   DraggedComponentStyle (RO) = #<VLA-OBJECT IAeccLabelDraggedComponentStyle 000000002fcfed80>
;   DraggedLeaderStyle (RO) = #<VLA-OBJECT IAeccLabelDraggedLeaderStyle 000000002fcfe630>
;   Handle (RO) = "F663"
;   HasExtensionDictionary (RO) = 0
;   LabelProperties (RO) = #<VLA-OBJECT IAeccLabelStyleProperties 000000002fcfee10>
;   LineComponents (RO) = #<VLA-OBJECT IAeccLabelStyleLineComponents 000000002fcfe780>
;   ModifiedBy (RO) = "GH0276"
;   Name = "_COGG Point Number"
;   ObjectID (RO) = 48
;   ObjectID32 (RO) = 48
;   ObjectName (RO) = "AeccDbLabelStyleCollector"
;   OwnerID (RO) = 49
;   OwnerID32 (RO) = 49
;   Parent (RO) = #<VLA-OBJECT IAeccLabelStyle 00000000306bb2d0>
;   TextComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTextComponents 000000002fcfe750>
;   TickComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTickComponents 000000002fcfe2d0>
;   Type (RO) =:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 000000002fcff590>
;   BlockComponents (RO) = #<VLA-OBJECT IAeccLabelStyleBlockComponents 000000002fcfecc0>
;   Children (RO) = #<VLA-OBJECT IAeccLabelStyles 000000002fceb588>
;   CreatedBy = "autodesk"
;   DateCreated (RO) = "21/08/2004 12:50:58 AM"
;   DateModified (RO) = "18/06/2007 5:31:48 PM"
;   Descendants (RO) = #<VLA-OBJECT IAeccLabelStyles 000000002fceaec8>
;   Description = "Point Number"
;   DirectionArrowComponents (RO) = #<VLA-OBJECT IAeccLabelStyleDirectionArrowComponents 000000002fcff080>
;   Document (RO) = #<VLA-OBJECT IAeccDocument 000000002fcfeb10>
;   DraggedComponentStyle (RO) = #<VLA-OBJECT IAeccLabelDraggedComponentStyle 000000002fcfed80>
;   DraggedLeaderStyle (RO) = #<VLA-OBJECT IAeccLabelDraggedLeaderStyle 000000002fcfe630>
;   Handle (RO) = "F663"
;   HasExtensionDictionary (RO) = 0
;   LabelProperties (RO) = #<VLA-OBJECT IAeccLabelStyleProperties 000000002fcfee10>
;   LineComponents (RO) = #<VLA-OBJECT IAeccLabelStyleLineComponents 000000002fcfe780>
;   ModifiedBy (RO) = "GH0276"
;   Name = "_Point Number"
;   ObjectID (RO) = 48
;   ObjectID32 (RO) = 48
;   ObjectName (RO) = "AeccDbLabelStyleCollector"
;   OwnerID (RO) = 49
;   OwnerID32 (RO) = 49
;   Parent (RO) = #<VLA-OBJECT IAeccLabelStyle 00000000306bb2d0>
;   TextComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTextComponents 000000002fcfe750>
;   TickComponents (RO) = #<VLA-OBJECT IAeccLabelStyleTickComponents 000000002fcfe2d0>
;   Type (RO) = 15

(setq txtcomps (vlax-get lblstyl1 'LabelProperties))
(setq stname (vlax-get lblstyl1 'name)) ; name of label

; Property values:
;   ForcedInsertion (RO) = #<VLA-OBJECT IAeccPropertyEnumForcedInsertion 00000000304e51b0>
;   ForceInsideCurve (RO) = #<VLA-OBJECT IAeccPropertyBoolean 00000000304de220>
;   Layer (RO) = #<VLA-OBJECT IAeccPropertyLayer 00000000304e4250>
;   OrientationReference (RO) = #<VLA-OBJECT IAeccPropertyEnumOrientationReference 00000000304e0b00>
;   PlanReadable (RO) = #<VLA-OBJECT IAeccPropertyBoolean 00000000304e26f0>
;   PlanReadableBias (RO) = #<VLA-OBJECT IAeccPropertyDouble 00000000304defd0>
;   PlanReadableFlipAnchors (RO) = #<VLA-OBJECT IAeccPropertyBoolean 00000000304de7c0>
;   TagDisplayMode (RO) = #<VLA-OBJECT IAeccPropertyBoolean 00000000304df0c0>
;   TextStyle (RO) = #<VLA-OBJECT IAeccPropertyTextStyle 00000000304df630>
;   Visibility (RO) = #<VLA-OBJECT IAeccPropertyBoolean 00000000304de670>
;   YOffset (RO) = #<VLA-OBJECT IAeccPropertyDouble 00000000304e30e0>

(setq lay (vlax-get-property txtcomps 'layer))
(setq LayVal (vlax-get-property lay 'value)) ;this is layer name for Stname

;(setq xOff (vlax-get-property txtcomps 'XOffset))
;(setq xVal (vlax-get-property xOff 'value))
;(setq yOff (vlax-get-property txtcomps'YOffset))
;(setq yVal (vlax-get-property yOff 'value))

  • 9 years later...
Posted
On 2/17/2015 at 9:00 PM, BIGAL said:

Here is a start, I have now jumped to points

 

 

CADTutor: still the gift that keeps on giving! I've been looking for the secret to getting surface names out of Civil 3D, and here it is!

 

Work on my swale label function will be downhill from here. I'll post it in the Civil forum when it's done.

Posted

"getting surface names out of Civil 3D" I have change the surface display as a toolbar with icons it includes on/off, flow arrows, different contour intervals, avoids using toolspace. 

 

image.png.71367125eeff5afe75b05d3182713b6e.png

 

Just ask and can send you the code images etc. As default is metric, but its all open code so can also do imperial. The  surface style name is setup in the toolbar.mnu.

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