BIGAL 发表于 2022-7-5 20:50:52

现在到达那里将生成输出的csv文件,以便可以排序等,需要设置重复循环,然后再次执行所有操作,一个问题'AlignmentLabelStyles,同时我可以通过dump获取它们的名称,再次努力将其作为变量返回。最终也会做点什么。
 
(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))

BIGAL 发表于 2022-7-5 20:55:37

由于点样式从更高级别开始,从点开始的方法略有不同。
 
明天我会发布对齐代码,可能会从点开始。这是一个使用Vlax转储对象获取下一级信息的例子。

BIGAL 发表于 2022-7-5 20:58:53

这是一个开始,我现在已经跳到要点,我要做的是提供一个代码示例,但将提供一个词。通过VLAX-DUMP突出显示子实体,以便您可以看到树并添加您可能想要自定义的任何“组件”设置,我需要将其作为点样式,例如8个组件和大约6个+项目=48个+变量。甚至可以将树中的代码粘贴到Autocad DWG中。我遇到的一件事是在标签样式中使用块。重新缩放的问题意味着更改8个组件。见下文
 

(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

Hippe013 发表于 2022-7-5 21:02:48

比加尔,
 
我喜欢你在这里试图做的事情的意图。我也在努力寻找使用特定图层的风格。不过,我会想象这种方法会略有不同。
 
我设想了一个函数,该函数将返回使用给定层名称的所有样式(样式名称)。然后遍历所有样式并返回使用该特定层的样式。我还会检查“对象层”,看看那里是否也使用了该层。我还可以想象一个函数除了查找使用特定块的样式外,还可以做相同的事情。
 
在某种意义上,这就是你想要实现的吗?
 
当做
 
hippe013

BIGAL 发表于 2022-7-5 21:06:29

Hippe013我们希望清理我们的模板,消除层命名和管理中的一些过度热情。
 
最终结果将是一个csv文件,我们可以将更改添加到该文件中,然后重新运行相反的文件来更新许多值。可能会添加更多内容,如文字样式颜色等。
 
第三部分是转储到excel,并使用它通过复制和修改来创建新样式。
 
关键的事情来了,有点费时。

BIGAL 发表于 2022-7-5 21:09:51

还有一点,做了一些研究,在Blackbox的AUGI论坛上发现了一些不错的链接,这些链接涉及可用的商业软件,这些软件在层名称和使用它的风格方面做得很好。目前,我们只需下载csv并使用excel对计数进行排序等,最终的方法是反向处理,将csv+新图层名,返回到样式中,然后处理更多方面,如缩放预定义的标签样式。
 
任何人,如果你创建一个点样式这个例子TBM ie x y z D在一个盒子里使用一个块,我找不到任何全局比例因子,但属性指的是x-y比例?如果你改变旋转角度,它就会起作用
 


;(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))
页: 1 [2]
查看完整版本: 深入CIV3d风格