Jump to content

ssget "x" act differently in command line vs console/lisp?


Jef!

Recommended Posts

Hi everyone! Sorry for the lenght, better too many than not enough. This puzzle dazzle me me totally. I'm sure you will like it too.

 

Some coworkers use drawingviews (viewbase). We had some issues for the pages detailing the steel plates to be cutted cnc. Since drawingviews cannot be wblocked, the way to go is to use file-> Export layout to model. It works great, and if lets say all the drawingviews are 1:4, the exported 2d layout scale them accordingly and the result is 1:1.. wblock each part, bam! its done.

The problem is that when more than one scale is used, the whole page is exported and scale using the scale of any random view, and CAD rescale the rest with the wrong scale factor.

 

few additionnal precisions concerning drawing views:

-they are filtered off of some commands (copy and wblock for instance)

-they cannot be fed to an entsel (filtered out leaving error: bad argument type: lentityp nil)

 

ok. my thought, using lisp to give me a message if more than 1 scale is used over the page just so i am aware. After that I have few ideas on what i could do next, but i have to retrieve some information on these drawingviews first. So i'm there, I got my drawing open, my coffee and music. After trying to know about then using entsel, I make another try at the command line

Command: (setq zzz (ssget "x" '((0 . "drawingview"))))

Excellent beginning. I iterate through the selection and using vlax-dump-objects/dumpallproperties I see them! Victory!

 

I add the defun, a little princ at the end, the closing bracket.

(defun C:test ( / )
  (if (setq zzz (ssget "x" '((0 . "drawingview"))))
      (repeat (setq i (sslength zzz))
              (setq e (ssname zzz (setq i (1- i)))
                VLobj (vlax-ename->vla-object e)
              )
              (princ "item #")(princ i)(princ ": Result of dumpallproperties: \n") (dumpallproperties e)
              (princ "\n\nitem #")(princ i)(princ ": Result of vlax-dump-object: \n")(vlax-dump-object vlobj)
              (princ "\n*******END OF ITEM #")(princ i)(princ "\n\n")
      )
      (princ "no selection found!")
  )
  (princ)
)

 

Ready to go!

Command: TEST

no selection found!

hmmm.. in console? same as integrated in a lisp..

_$ (setq zzz (ssget "x" '((0 . "drawingview"))))

nil

 

but in command line(using the "if"), it make Autocad sing...

Command: (if (setq zzz (ssget "x" '((0 . "drawingview"))))
(_>        (repeat (setq i (sslength zzz))
((_>                (setq e (ssname zzz (setq i (1- i)))
(((_>                  VLobj (vlax-ename->vla-object e)
(((_>                )
((_>                (princ "item #")(princ i)(princ ": Result of dumpallproperties: \n") (dumpallproperties e)
((_>                (princ "\n\nitem #")(princ i)(princ ": Result of vlax-dump-object: \n")(vlax-dump-object vlobj)
((_>                (princ "\n*******END OF ITEM #")(princ i)(princ "\n\n")
((_>        )
(_>        (princ "no selection found!")
(_>    )
item #1: Result of dumpallproperties:
Begin dumping object (class: AcDbViewBorder)
Annotative (type: bool)  (LocalName: Annotative) = Failed to get value
AnnotativeScale (type: AcString)  (RO)  (LocalName: Annotative scale) = Failed to get value
BlockId (type: AcDbObjectId)  (RO) = 7ffffb52670
CastShadows (type: bool) = 1
ClassName (type: AcString)  (RO) =
CollisionType (type: AcDb::CollisionType)  (RO) = 1
Color (type: AcCmColor)  (LocalName: Color) = BYLAYER
CustomScale (type: double)  (RO)  (LocalName: Custom scale) = 4.000000
DesignView (type: AcString)  (RO)  (LocalName: Design view) = Failed to get value
DetailBoundaryShape (type: AcDbViewProp::DetailBoundaryType)  (LocalName: Boundary type) = Failed to get value
DetailIdentifier (type: AcString)  (LocalName: Detail identifier) = Failed to get value
EndIdentifier (type: AcString)  (RO)  (LocalName: End identifier) = Failed to get value
ExtensionDictionary (type: AcDbObjectId)  (RO) = 0
FamilyMember (type: AcString)  (RO)  (LocalName: Family member) = Failed to get value
Handle (type: AcDbHandle)  (RO) = 7eb85
HasFields (type: bool)  (RO) = 0
HasSaveVersionOverride (type: bool) = 0
Height (type: double)  (RO)  (LocalName: Height) = 2.913089
HiddenLineCalculation (type: aciv::ViewEnums::ERefAndNonRefTreatment)  (RO)  (LocalName: Hidden line calculation) = Failed to get value
Hyperlinks (type: AcDbHyperlink*)
InheritSectioncut (type: AcDbViewFacet::YesNoType)  (RO)  (LocalName: Inherit section cut) = Failed to get value
InsertionPointX (type: double)  (LocalName: Insertion point X) = 10.278607
InsertionPointY (type: double)  (LocalName: Insertion point Y) = 8.392718
InsertionPointZ (type: double)  (RO)  (LocalName: Insertion point Z) = 0.000000
InterferenceEdges (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Interference edges) = Failed to get value
IsA (type: AcRxClass*)  (RO) = AcDbViewBorder
IsAProxy (type: bool)  (RO) = 0
IsCancelling (type: bool)  (RO) = 0
IsEraseStatusToggled (type: bool)  (RO) = 0
IsErased (type: bool)  (RO) = 0
IsModified (type: bool)  (RO) = 0
IsModifiedGraphics (type: bool)  (RO) = 0
IsModifiedXData (type: bool)  (RO) = 0
IsNewObject (type: bool)  (RO) = 0
IsNotifyEnabled (type: bool)  (RO) = 0
IsNotifying (type: bool)  (RO) = 0
IsObjectIdsInFlux (type: bool)  (RO) = 0
IsPersistent (type: bool)  (RO) = 1
IsPlanar (type: bool)  (RO) = 0
IsReadEnabled (type: bool)  (RO) = 1
IsReallyClosing (type: bool)  (RO) = 1
IsTransactionResident (type: bool)  (RO) = 0
IsUndoing (type: bool)  (RO) = 0
IsWriteEnabled (type: bool)  (RO) = 0
Justification (type: aciv::ViewEnums::EViewJustification)  (RO)  (LocalName: Justification) = 1
LabelPosition (type: AcDbViewProp::LabelPositionType)  (LocalName: Label position) = Failed to get value
LayerId (type: AcDbObjectId)  (LocalName: Layer) = 7ffffbb8f60
LevelOfDetailRepresentation (type: AcString)  (RO)  (LocalName: Level of detail representation) = Failed to get value
LineWeight (type: AcDb::LineWeight)  (LocalName: Lineweight) = Failed to get value
Linetype (type: AcDbViewProp::LineType)  (RO)  (LocalName: Line style) = Failed to get value
LinetypeId (type: AcDbObjectId)  (LocalName: Linetype) = Failed to get value
LinetypeScale (type: double)  (LocalName: Linetype scale) = Failed to get value
LocalizedName (type: AcString)  (RO) = Drawing View
MaterialId (type: AcDbObjectId)  (LocalName: Material) = Failed to get value
MergeStyle (type: AcDb::DuplicateRecordCloning)  (RO) = 1
ModelEdge (type: AcDbDetailViewStyle::ModelEdge)  (LocalName: Model edge) = Failed to get value
Name (type: AcString)  (RO)  (LocalName: Name) = Failed to get value
ObjectId (type: AcDbObjectId)  (RO) = 7ffffb549d0
OwnerId (type: AcDbObjectId)  (RO) = 7ffffb52670
Path (type: AcString)  (RO)  (LocalName: Path) = Failed to get value
PlotStyleName (type: AcString)  (LocalName: Plot style) = ByLayer
PositionalRepresentation (type: AcString)  (RO)  (LocalName: Positional representation) = Failed to get value
PreparationName (type: AcString)  (RO)  (LocalName: Preparation name) = Failed to get value
PresentationTrails (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Presentation trails) = Failed to get value
PresentationView (type: AcString)  (RO)  (LocalName: Presentation view) = Failed to get value
ProjectionAngle (type: AcDbViewRepStandard::ProjectionType)  (RO)  (LocalName: Projection angle) = 1
ReceiveShadows (type: bool) = 1
Rotation (type: double)  (LocalName: Rotation) = 0.000000
SectionDepth (type: AcDbViewProp::SectionDepthType)  (LocalName: Depth) = Failed to get value
SectionDistance (type: double)  (LocalName: Distance) = Failed to get value
SectionProjection (type: AcDbViewProp::SectionProjectionType)  (RO)  (LocalName: Projection) = Failed to get value
ShadeResolution (type: AcDbViewRepStandard::DpiResolutionType)  (RO)  (LocalName: Shade resolution) = 100
ShadowDisplay (type: AcDb::ShadowFlags)  (LocalName: Shadow Display) = Failed to get value
SheetMetalBendExtents (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Sheet metal bend extents) = Failed to get value
SheetMetalState (type: AcDbViewProp::SheetMetalType)  (RO)  (LocalName: Sheet metal state) = Failed to get value
ShowHatching (type: AcDbViewFacet::YesNoType)  (LocalName: Show hatching) = Failed to get value
ShowViewLabel (type: AcDbViewFacet::YesNoType)  (LocalName: Show view label) = Failed to get value
Source (type: AcDbViewRep::SourceType)  (RO)  (LocalName: Source) = 3
StandardScale (type: ScaleValue)  (LocalName: Standard scale) = 2
StandardScaleViewLabel (type: AcString)  (RO) = 4:1
StartIdentifier (type: AcString)  (LocalName: Start identifier) = Failed to get value
TangentEdges (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Tangent edges) = 0
TangentEdgesForeshortened (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Tangent edges foreshortened) = 0
ThreadFeatures (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Thread features) = Failed to get value
Transparency (type: AcCmTransparency)  (LocalName: Transparency) = 0
ViewAignment (type: AcDbViewProp::AlignmentType)  (RO)  (LocalName: View alignment) = Failed to get value
ViewStyle (type: AcDbViewProp::ViewStyleType)  (RO)  (LocalName: Hidden lines) = 2
ViewType (type: AcDbViewProp::ViewType)  (RO)  (LocalName: View type) = 0
Visible (type: AcDb::Visibility) = 0
WeldmentState (type: AcDbViewProp::WeldmentType)  (RO)  (LocalName: Weldment state) = Failed to get value
Width (type: double)  (RO)  (LocalName: Width) = 4.619484
End object dump
item #1: Result of vlax-dump-object:
; IAcadViewBorderWrapper: nil
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 0000000140469110>
;   Document (RO) = #<VLA-OBJECT IAcadDocument 00000000289aaa78>
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "7EB85"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 00000000391ac568>
;   Layer = "DIM"
;   Linetype = "ACAD_VIEWBORDER_LINETYPE"
;   LinetypeScale = 0.25
;   Lineweight = -1
;   Material = "ByLayer"
;   ObjectID (RO) = 43
;   ObjectName (RO) = "AcDbViewBorder"
;   OwnerID (RO) = 45
;   PlotStyleName = "ByLayer"
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 00000000391a91a0>
;   Visible = -1
*******END OF ITEM #1
item #0: Result of dumpallproperties:
Begin dumping object (class: AcDbViewBorder)
Annotative (type: bool)  (LocalName: Annotative) = Failed to get value
AnnotativeScale (type: AcString)  (RO)  (LocalName: Annotative scale) = Failed to get value
BlockId (type: AcDbObjectId)  (RO) = 7ffffb52670
CastShadows (type: bool) = 1
ClassName (type: AcString)  (RO) =
CollisionType (type: AcDb::CollisionType)  (RO) = 1
Color (type: AcCmColor)  (LocalName: Color) = BYLAYER
CustomScale (type: double)  (RO)  (LocalName: Custom scale) = 4.000000
DesignView (type: AcString)  (RO)  (LocalName: Design view) = Failed to get value
DetailBoundaryShape (type: AcDbViewProp::DetailBoundaryType)  (LocalName: Boundary type) = Failed to get value
DetailIdentifier (type: AcString)  (LocalName: Detail identifier) = Failed to get value
EndIdentifier (type: AcString)  (RO)  (LocalName: End identifier) = Failed to get value
ExtensionDictionary (type: AcDbObjectId)  (RO) = 0
FamilyMember (type: AcString)  (RO)  (LocalName: Family member) = Failed to get value
Handle (type: AcDbHandle)  (RO) = 7ebd8
HasFields (type: bool)  (RO) = 0
HasSaveVersionOverride (type: bool) = 0
Height (type: double)  (RO)  (LocalName: Height) = 0.844753
HiddenLineCalculation (type: aciv::ViewEnums::ERefAndNonRefTreatment)  (RO)  (LocalName: Hidden line calculation) = Failed to get value
Hyperlinks (type: AcDbHyperlink*)
InheritSectioncut (type: AcDbViewFacet::YesNoType)  (RO)  (LocalName: Inherit section cut) = Failed to get value
InsertionPointX (type: double)  (LocalName: Insertion point X) = 10.278607
InsertionPointY (type: double)  (LocalName: Insertion point Y) = 11.425951
InsertionPointZ (type: double)  (RO)  (LocalName: Insertion point Z) = 0.000000
InterferenceEdges (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Interference edges) = Failed to get value
IsA (type: AcRxClass*)  (RO) = AcDbViewBorder
IsAProxy (type: bool)  (RO) = 0
IsCancelling (type: bool)  (RO) = 0
IsEraseStatusToggled (type: bool)  (RO) = 0
IsErased (type: bool)  (RO) = 0
IsModified (type: bool)  (RO) = 0
IsModifiedGraphics (type: bool)  (RO) = 0
IsModifiedXData (type: bool)  (RO) = 0
IsNewObject (type: bool)  (RO) = 0
IsNotifyEnabled (type: bool)  (RO) = 0
IsNotifying (type: bool)  (RO) = 0
IsObjectIdsInFlux (type: bool)  (RO) = 0
IsPersistent (type: bool)  (RO) = 1
IsPlanar (type: bool)  (RO) = 0
IsReadEnabled (type: bool)  (RO) = 1
IsReallyClosing (type: bool)  (RO) = 1
IsTransactionResident (type: bool)  (RO) = 0
IsUndoing (type: bool)  (RO) = 0
IsWriteEnabled (type: bool)  (RO) = 0
Justification (type: aciv::ViewEnums::EViewJustification)  (RO)  (LocalName: Justification) = 1
LabelPosition (type: AcDbViewProp::LabelPositionType)  (LocalName: Label position) = Failed to get value
LayerId (type: AcDbObjectId)  (LocalName: Layer) = 7ffffbb8f60
LevelOfDetailRepresentation (type: AcString)  (RO)  (LocalName: Level of detail representation) = Failed to get value
LineWeight (type: AcDb::LineWeight)  (LocalName: Lineweight) = Failed to get value
Linetype (type: AcDbViewProp::LineType)  (RO)  (LocalName: Line style) = Failed to get value
LinetypeId (type: AcDbObjectId)  (LocalName: Linetype) = Failed to get value
LinetypeScale (type: double)  (LocalName: Linetype scale) = Failed to get value
LocalizedName (type: AcString)  (RO) = Drawing View
MaterialId (type: AcDbObjectId)  (LocalName: Material) = Failed to get value
MergeStyle (type: AcDb::DuplicateRecordCloning)  (RO) = 1
ModelEdge (type: AcDbDetailViewStyle::ModelEdge)  (LocalName: Model edge) = Failed to get value
Name (type: AcString)  (RO)  (LocalName: Name) = Failed to get value
ObjectId (type: AcDbObjectId)  (RO) = 7ffffb54f00
OwnerId (type: AcDbObjectId)  (RO) = 7ffffb52670
Path (type: AcString)  (RO)  (LocalName: Path) = Failed to get value
PlotStyleName (type: AcString)  (LocalName: Plot style) = ByLayer
PositionalRepresentation (type: AcString)  (RO)  (LocalName: Positional representation) = Failed to get value
PreparationName (type: AcString)  (RO)  (LocalName: Preparation name) = Failed to get value
PresentationTrails (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Presentation trails) = Failed to get value
PresentationView (type: AcString)  (RO)  (LocalName: Presentation view) = Failed to get value
ProjectionAngle (type: AcDbViewRepStandard::ProjectionType)  (RO)  (LocalName: Projection angle) = 1
ReceiveShadows (type: bool) = 1
Rotation (type: double)  (LocalName: Rotation) = 0.000000
SectionDepth (type: AcDbViewProp::SectionDepthType)  (LocalName: Depth) = Failed to get value
SectionDistance (type: double)  (LocalName: Distance) = Failed to get value
SectionProjection (type: AcDbViewProp::SectionProjectionType)  (RO)  (LocalName: Projection) = Failed to get value
ShadeResolution (type: AcDbViewRepStandard::DpiResolutionType)  (RO)  (LocalName: Shade resolution) = 100
ShadowDisplay (type: AcDb::ShadowFlags)  (LocalName: Shadow Display) = Failed to get value
SheetMetalBendExtents (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Sheet metal bend extents) = Failed to get value
SheetMetalState (type: AcDbViewProp::SheetMetalType)  (RO)  (LocalName: Sheet metal state) = Failed to get value
ShowHatching (type: AcDbViewFacet::YesNoType)  (LocalName: Show hatching) = Failed to get value
ShowViewLabel (type: AcDbViewFacet::YesNoType)  (LocalName: Show view label) = Failed to get value
Source (type: AcDbViewRep::SourceType)  (RO)  (LocalName: Source) = 3
StandardScale (type: ScaleValue)  (LocalName: Standard scale) = 0
StandardScaleViewLabel (type: AcString)  (RO) = 4:1
StartIdentifier (type: AcString)  (LocalName: Start identifier) = Failed to get value
TangentEdges (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Tangent edges) = 0
TangentEdgesForeshortened (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Tangent edges foreshortened) = 0
ThreadFeatures (type: AcDbViewFacet::OnOffType)  (RO)  (LocalName: Thread features) = Failed to get value
Transparency (type: AcCmTransparency)  (LocalName: Transparency) = 0
ViewAignment (type: AcDbViewProp::AlignmentType)  (LocalName: View alignment) = 0
ViewStyle (type: AcDbViewProp::ViewStyleType)  (RO)  (LocalName: Hidden lines) = 0
ViewType (type: AcDbViewProp::ViewType)  (RO)  (LocalName: View type) = 1
Visible (type: AcDb::Visibility) = 0
WeldmentState (type: AcDbViewProp::WeldmentType)  (RO)  (LocalName: Weldment state) = Failed to get value
Width (type: double)  (RO)  (LocalName: Width) = 4.619484
End object dump
item #0: Result of vlax-dump-object:
; IAcadViewBorderWrapper: nil
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 0000000140469110>
;   Document (RO) = #<VLA-OBJECT IAcadDocument 00000000289aaa78>
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "7EBD8"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 00000000396ec468>
;   Layer = "DIM"
;   Linetype = "ACAD_VIEWBORDER_LINETYPE"
;   LinetypeScale = 0.25
;   Lineweight = -1
;   Material = "ByLayer"
;   ObjectID (RO) = 46
;   ObjectName (RO) = "AcDbViewBorder"
;   OwnerID (RO) = 45
;   PlotStyleName = "ByLayer"
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 00000000396ed960>
;   Visible = -1
*******END OF ITEM #0
"\n\n"

Why wont that work added into a lisp command?

 

Any comments, ideas, suggestions ... alternate way of... anything to shed light on me are welcome

Cheers,

Jef!

Link to comment
Share on other sites

I don't have that object name drawingview to test the program , but try to get used to localize variables in every program you may write to avoid the intervention between programs if variables are matched in any case .

 

One more thing is to replace the mode string of the ssget function from "x" to "_X" .

Link to comment
Share on other sites

Hi Tharwat...

 

To have a drawing view, you must have at least a 1 solid3d model or inventor files.(*.iam, *.ipt, *.ipn)

you can create a box in model, then in paperspace type "viewbase", then make 1 with few clicks.

 

For the variables, I do systematically localize every variable. Ive unlocalized them only for debug purposes, and when i do I make sure to check them all first

Command: !zzz

nil

Command: !i

nil

Command: !e

nil

Command: !VLobj

nil

I really could use a few hours class on how to use the full power of the vlide and debuging/var monitoring without having to unlocalize them, as it is a pita when trying to debug multiple routines working together.

 

Thanks for the input on "_X" instead of "x", i never noticed that one. I've tryed to make the change, the result remains the same.

 

Command: (defun C:test ( / zzz i e VLobj)

(_> (if (setq zzz (ssget "_X" '((0 . "drawingview"))))

((_> (repeat (setq i (sslength zzz))

(((_> (setq e (ssname zzz (setq i (1- i)))

((((_> VLobj (vlax-ename->vla-object e)

((((_> )

(((_> (princ "item #")(princ i)(princ ": Result of dumpallproperties: \n") (dumpallproperties e)

(((_> (princ "\n\nitem #")(princ i)(princ ": Result of vlax-dump-object: \n")(vlax-dump-object vlobj)

(((_> (princ "\n*******END OF ITEM #")(princ i)(princ "\n\n")

(((_> )

((_> (princ "no selection found!")

((_> )

(_> (princ)

(_> )

C:TEST

Command: TEST

no selection found!

...and again with only the "if" portion (which is everything except the final (princ) Cad sings like a bird and it works like a charm.

Link to comment
Share on other sites

I've also observed this behaviour when working with DRAWINGVIEW objects, as I have previously tried to automate a process of centering drawing views in a sheet of a fixed size.

 

I found that the views may be selected when expressions are evaluated at the command-line, but not when evaluated from within an AutoLISP command; I have also found this behaviour to be apparent when issuing a 'manual' ssget selection (as opposed to using the "X" mode string). It would seem that a restriction has been imposed on manipulating drawing views using AutoLISP, and I'm not sure there is any way around this.

 

Lee

Link to comment
Share on other sites

Hi Lee, thanks for poping in.

 

I'm not sure I understand what you are reffering to when you talk about a "manual" ssget.. would there be another way of not "x" ssget-ing them?

If YOU tried to manipulate drawing views and have not found any way around the restriction, I don't think I have a much chope of achieving anything more than you. I'm sure you tried many (if not all approaches) lisp, vlisp, Active-X, vodoo dolls and spell casting.

 

My feeling on why they sometimes seems to put restrictions such as these is that they are affraid of killing their own market on some of their other softwares.

 

Anyway.. if i find a way ill let you know, likewise if you find something new, let us know!

thanks

Link to comment
Share on other sites

I'm not sure I understand what you are reffering to when you talk about a "manual" ssget.. would there be another way of not "x" ssget-ing them?

 

I mean a non-automated selection, observe the following command-line output when attempting to select the same drawing view object:

Command: (ssget)

Select objects: Specify opposite corner: 1 found

Select objects:
<Selection set: 53>

Command: (defun c:test nil (ssget))
C:TEST

Command: test
Select objects: Specify opposite corner: 1 found
1 was filtered out

Select objects:
nil

 

If YOU tried to manipulate drawing views and have not found any way around the restriction, I don't think I have a much chope of achieving anything more than you. I'm sure you tried many (if not all approaches) lisp, vlisp, Active-X, vodoo dolls and spell casting.

 

Haha! I did try a good few different methods, but certainly feel free to experiment yourself!

 

My feeling on why they sometimes seems to put restrictions such as these is that they are affraid of killing their own market on some of their other softwares.

 

In this case I don't think this is an intentional restriction implemented by Autodesk, but rather a subtle consequence of objects such as drawing views being introduced long after development of the AutoLISP API has ceased and therefore such objects don't play well. /just a guess.

 

Lee

Link to comment
Share on other sites

Leeeeeeee! :shock:

 

Tell me what you think about that

 

(defun test2 ( *SEL* / i e VLobj)
  (repeat (setq i (sslength *SEL*))
          (setq e (ssname *SEL* (setq i (1- i)))
            VLobj (vlax-ename->vla-object e)
          )
          (princ "item #")(princ i)(princ ": Result of dumpallproperties: \n") (dumpallproperties e)
          (princ "\n\nitem #")(princ i)(princ ": Result of vlax-dump-object: \n")(vlax-dump-object vlobj)
          (princ "\n*******END OF ITEM #")(princ i)(princ "\n\n")
  )
  (if zzz (setq zzz nil))
  (princ)
)

 

Then try adding a custom button in a toolbar, and as a macro add that

^C^C(if (setq zzz (ssget "_X" '((0 . "drawingview"))))(TEST2 ZZZ)(princ "no selection found!"))(princ)

 

To dump properties, it works! Now what I have to figure out is if properties can be modified in the same manner... I didnt have much luck so far to retrieve them, because the props I need are only available with lisp (dumpallproperties) and not with (vlax-dump-object). I tried to retrieve the scale but didnt manage.. Here'S what i tried to add in my repeat

(setq scale (getpropertyVALUE e 'CustomScale))

but it did not return anything... I'm not even sure I'm doing the correct thing, ill have to make some research on that, unless you shed some light on how to retrieve/modify them. i guess that only properties seen with (vlax-dump-object) can be retrieved/modified with (vla-get-property) and (vla-put-property) ??

For now I need to retrieve all the drawing views scales, and supress some.

I'll sleep on that for tonight, ill dig further in tomorrow. In the meantime, if you investigate on that, i'll be glad to read what your discoveries were...

 

I hope my findings can be usefull...

  • Like 1
Link to comment
Share on other sites

  • 8 years later...

I believe that I have found a work around solution, but a solution nonetheless. It utilizes calling a script mid program which in turn calls the original lisp back. A few global variables manage the passing of data between the two. Due to this use of global variables proceed with great care.

 

I have attached a program I wrote that automatically fixes dims to Viewports and Viewbase for you. See structure for technique to select and manipulate Drawing Views. (Make sure to update the Filepath on Line 104 for where you'll save the script file to)

 

Credit to Lee for several subfunctions that help with writing the script within the lisp program.

 

FIXDIMS.lsp

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