Jump to content

xref clip boundry


cadman6735

Recommended Posts

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    20

  • cadman6735

    17

  • BlackBox

    15

  • alanjt

    8

Top Posters In This Topic

Posted Images

Lee

Thanks for explaining this to me and I would agree that sub-functions should not be too hard of a concept to grasp. I have a general idea of how they work.

 

- I understand that when you gurus supply your code as examples, you have a collection of libraries that are all sub-functions that you call upon and modify as required for your coding.

 

- The only experiance I have so far with arguments are human supplied, where the code asks the user for info and passes it on to the code for processing.

Where in your code above does ( name ) get its info from?

 

- I copied and pasted your code above into my Visual lisp editor and loaded it, I typed at the command prompt (GetBlockObject) and recieved this message:

 

Command: (GetBlockObject)

; error: too few arguments

 

 

Lee, can I ask you to act like you are me and copy-paste the code you provide above into your visual lisp editor load and run it on a drawing file with an xrefs and tell me if you get the same message as me? Because I am defently missing a concept to make this work.

 

(defun GetBlockObject ( name )  (if (tblsearch "BLOCK" name)    (vla-item      (vla-get-Blocks        (vla-get-ActiveDocument          (vlax-get-acad-object)        )      )      name    )  ))

 

 

Trust me, I am learning something from all of this, even if I am missing the point of this thread. :thumbsup:

 

Thanks Lee

Link to comment
Share on other sites

Cadman, in your previous post you included some code (a sub-function) that requires an argument.

 

Please open a drawing with a block, and determine the name of any one block... for this example, lets say the block's name is "Block1".

 

Once you load the code you posted above, enter this into the command line:

** Don't forget about (vl-load-com) **

 

(setq [color=seagreen]blk[/color][color=seagreen]O[/color][color=seagreen]bj[/color] ([color=red]GetBlockObject[/color] "[color=blue]Block1[/color]"))

 

 

You should get something like this as a result:

 

Command: (setq blkObj (getblockobject "Block1"))
[color=seagreen]#<VLA-OBJECT IAcadBlock2 0cd825b4>[/color]

 

 

What the GetBlockObject function does, provide that you've supplied the block's "name" as the argument, is to return the Vla-Object... for you to manipulate further.

 

Where:

  • "Block1" is the argument
  • GetBlockObject is the sub-function
  • and blkObj is the variable storing the 'Block's vla-object'

... Make sense?

Edited by BlackBox
Clarity
Link to comment
Share on other sites

Renderman,

 

I was just figuring this out from Lee's post and was about to ask if I need to supply a block name such as "MyBlockName"

 

(GetBlockObject "MyBlockName")

 

If this is the case, no wonder I could not figure it out, this example of code was not what I was expecting nor was it what I think I was asking for. I think something got lost in communication... Typing thoughts is so hard.

 

 

All I am looking for is where can I find a list of xrefs and the properties that go with them in the visual lisp watch window. So I can get a list of xrefs, their file location, clip boundry information and if it is overlay or attached informaiton.

 

Which now I understand there are more functions involved, such as, :isxref

 

and I found the DXF code information in the help menu last night, thanks to Lee vanilla lisp. So I am on the right track.

 

But all this coding got me confussed. If I have to supply an argument for the block I am looking for, what is the point of having the code pull the block for me? This was my mind set and I can see I was thinking about this the wrong way.

 

I am sure I did not explain my issue well enough but learned so much in this process

 

Sorry for my confusion.

 

What seems easy and logical to you gurus is a bit mind bending to us beginners.

 

Thanks all

Link to comment
Share on other sites

Slight revision...

 

All I am looking for is where can I find ... the [methods and] properties that go with ... [a] visual lisp [object].

 

 

Okay, keeping things simple...

 

Use this to list the properties and methods available to a vla-object:

 

(defun c:DUMP  (/ eName)
 (vl-load-com)
 (if (setq eName (car (entsel "\n  >>  Select Object to Dump Contents: ")))
   (progn
     (textpage)
     (vlax-dump-object (vlax-ename->vla-object eName) T)
     (terpri))
   (prompt "\n  <!>  Nothing Selected  <!> "))
 (princ))

 

 

When prompted, manually select an xref, to get the specific properties and methods for an xref.

 

Good luck!

Link to comment
Share on other sites

Stupid Jargon... :wink:

 

Jargon is important...

 

Thanks Renderman

 

 

Edit...

 

I am waisting you guys time now... I will keep on studying...

Link to comment
Share on other sites

Nice code Renderman

 

very close to what I was looking for...

 

But

 

exactly what I asked for.

 

Thanks

 

 

You're welcome.

 

I use something similar as a tool when developing. Sometimes I know the property I want, but just want to know a value, etc.

 

Good luck!

Link to comment
Share on other sites

- The only experiance I have so far with arguments are human supplied, where the code asks the user for info and passes it on to the code for processing.

 

If you have written any sort of code, you have experience with argument passing, as you are passing arguments to most LISP functions.

 

Where in your code above does ( name ) get its info from?

 

- I copied and pasted your code above into my Visual lisp editor and loaded it, I typed at the command prompt (GetBlockObject) and recieved this message:

 

Command: (GetBlockObject)

; error: too few arguments

 

This is all answered in my previous post - I also provided an example of how to call the routine.

 

There were many questions in this thread, first, I believe you wanted to query the xref VLA-Object, hence I provided a code to return such an object to you for the specified xref.

 

Later, we provided codes to return a list of xrefs.

Link to comment
Share on other sites

Just to finish off, here are a few functions to get all the information you could want :)

 

 

Properties & Methods of XRef Object in Drawing:

(defun c:GetSelectedXrefInfo ( / entity )
 (vl-load-com)

 (if (and (setq entity (car (entsel "\nSelect XRef: ")))
          (eq "INSERT" (cdr (assoc 0 (entget entity))))
          (= 4 (logand 4 (cdr (assoc 70 (tblsearch "BLOCK" (cdr (assoc 2 (entget entity))))))))
     )
   (progn
     (vlax-dump-object (vlax-ename->vla-object entity) t)
     (textpage)
   )
 )

 (princ)
)

 

Get Propeties & Methods for All XRef Definitions in Drawing

(defun c:GetXRefsItemInfo nil
 (vl-load-com)

 (vlax-for block
   (vla-get-Blocks
     (vla-get-ActiveDocument
       (vlax-get-acad-object)
     )
   )
   (if (eq :vlax-true (vla-get-isXRef block))
     (progn
       (terpri)
       (vlax-dump-object block t)
     )
   )
 )

 (princ)
)

 

Get Properties & Methods for Single XRef Definition (supply with XRef name).

(defun GetXrefItemInfo ( xref )
 (vl-load-com)

 (if (tblsearch "BLOCK" xref)
   (vlax-dump-object
     (vla-item
       (vla-get-Blocks
         (vla-get-ActiveDocument
           (vlax-get-acad-object)
         )
       )
       xref
     )
     t
   )
 )

 (princ)
)

Link to comment
Share on other sites

Thanks Lee

 

Funny stuff Renderman...

 

 

This site and you gurus remind me of when I fist started MA...

 

I would watch the black belts and wish to be as half as good as they where. Once I learned the basics got some experiance the rest just fell into place. The only thing that disappointed me was there was no magic involved, just hard work.

 

Lee

Alan

Renderman

 

I hope to be half as good as you guys someday.

 

Thanks for sharing your knowledge

Link to comment
Share on other sites

I would watch the black belts and wish to be as half as good as they where. Once I learned the basics got some experiance the rest just fell into place. The only thing that disappointed me was there was no magic involved, just hard work.

 

Lee

Alan

Renderman

 

I hope to be half as good as you guys someday.

 

Thanks for sharing your knowledge

 

I'm sure there are many others much more knowledgeable to add to that list, but you're very welcome CADMan, I appreciate it.

Link to comment
Share on other sites

To be included among those I look up to, is quite a compliment, Cadman. :D

 

... Maybe there is something wrong with you!? :P lmao (Just kidding!)

Link to comment
Share on other sites

Renderman

 

Even the orange, green, blue and brown belts are impressive to a white belt...

 

There is something wrong with all of us and I can except that!!!

Link to comment
Share on other sites

There is something wrong with all of us and I can except that!!!

If there's something wrong with all of us, then that's the norm and thus, we're all normal.

Link to comment
Share on other sites

Renderman

 

Even the orange, green, blue and brown belts are impressive to a white belt...

 

There is something wrong with all of us and I can except that!!!

 

If there's something wrong with all of us, then that's the norm and thus, we're all normal.

 

 

~ Touché, my friends. :lol:

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