Jump to content

vlax-get-property on (vlax-get-acad-object).


Qonfire

Recommended Posts

Hello I spent 5 hours looking at this,please stop my sufferings.:)

 

(defun tempList (theObject / item dwgName) ;;;i[color="red"]tem here is nil,object acaddocuments[/color]
 (vl-load-com)  

(setq theList '())

 (vlax-for item theObject

[color="red"]    (setq dwgName (vlax-get-property item 'Name)) ;;;main question is in this line. 
1.how can i see this item in "(vlax-get-acad-object", everything is here right?),before calling its property.I'm using a watch to see whats happening.
2.can you please tell me what do you think i should  know on this issue[/color]


   (setq theList (append (list dwgName) theList))

 )

 (setq theList (reverse theList))

(princ)

);defun

(setq acadObject (vlax-get-acad-object))

(setq acadDocuments (vla-get-documents acadObject))

(tempList  acadDocuments)

Link to comment
Share on other sites

where theObject is (vla-get-documents (vlax-get-acad-object))

 

 (vlax-for item theObject
    (setq dwgName (vlax-get-property item 'Name))
(setq theList (append (list dwgName) theList)))

 

With how the code is setup now, you are collecting 'Name (drawing names) and saving those on a variable theList . a list of names. Now if you want to "see" the properties and methods

 

(vlax-for
  item  (vla-get-documents (vlax-get-acad-object))
 (setq theList (append (list item) theList)))

 

wherein you can have a look-see of the properties and methods (names included) of each element by

 

 (vlax-dump-object (nth 0 theList) T) ;<--- index 0

 

where 0 is the first and 1 as 2nd and so on

Link to comment
Share on other sites

to store open drawings name in a (?symbol? setq)

 

Ok, you got it fixed by pBe gently . :)

 

EDIT :

 

Another way of applying the list .

 

(vlax-for item (vla-get-documents (vlax-get-acad-object))
 (setq dwgNames (cons (vlax-get-property item 'Name) dwgNames))
)
(princ (apply 'strcat dwgnames))

Link to comment
Share on other sites

to store open drawings name in a (?symbol? setq)

 

Qonfire

 

The routine you have strores the names on a list theList, when you run the routine (tempList acadDocuments) you will get something like

("Drawing2.dwg" "Drawing3.dwg");

 

the way the code is written, theList variable is not localize. you can then use that for either foreach / repeat / mapcar / vl-some etc... with each element as the argument.

Link to comment
Share on other sites

(vlax-for item theObject

(setq dwgName (vlax-get-property item 'Name))

(setq theList (append (list dwgName) theList)))

 

my question is before we make a list of names. lets say we have 2 dwg.opened. One is actifdocument on is document.

 

i know how to get counts of dwg files...i can get name of a an actif document, but in the "watch", i dont see a non actif document.

 

ok let me put it this way, i see that when this line is running it takes a non-actif document (if not mistaken) and than itirates.

how can i see the avaible item in "watch" before running this line.

 

or

 

note: maybe in "watch" i cant see these items or i cant get to them.

 

appreciated

Link to comment
Share on other sites

note: maybe in "watch" i cant see these items or i cant get to them.

appreciated

 

 

You can get to them, but in the "Watch" window its so fast you can't "see" it. You can however use a breakpoint, the evaluation will pause when it hits the that point and you can continue by pressing CTRL+F8. I bet you'll see the value on watch window changing.

 

 (setq dwgName (vlax-get-property item 'Name<put breakpoint here>)))

Link to comment
Share on other sites

please look at my picasso pic attached.

 

question is in 1 jpeg

 

does this vlax get item ,changes active document as it iterates?

 

picture with an equal sign is second time item changes its name

 

please just a last push:)

2nd.jpg

1st.jpg

Link to comment
Share on other sites

The value for that will always be the "CURRENT" unless you invoke a vla-Activate , that will make the specified drawing active.

Link to comment
Share on other sites

(vla-item acadDocuments 0) 1 2 .....this what i think I looking.Thanks for help boys

 

No big deal Qonfire, All i did was add more confusion :rofl:

 

Moving along....

 

Cheers

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