Creating an isolate routine

Discussion in 'AutoCAD' started by Marcel Janmaat, Apr 29, 2004.

  1. I want to create a line over objects i am selecting wich may consist of
    lines, arcs, plines, (sometimes within blocks) etc. like with the ncopy
    command. and then offset it.

    The problem is, I cannot use the ncopy command within my own lisp.

    Has anyone maby got any suggestions on how to accomplish this???

    MJ
     
    Marcel Janmaat, Apr 29, 2004
    #1
  2. Marcel Janmaat

    John Uhden Guest

    Sorry I can't give it to you. Cadlantic has an XOFFSET routine to do exactly
    what you want, and more. The primary mechanism is to use (entmake) to enable
    the offspring to have user-selected properties at birth. Yes, there is a
    downloadable evaluation version.
     
    John Uhden, Apr 30, 2004
    #2
  3. This isn't exactly rocket science.

    Just use the vla-Explode method on the block insertions.
    It returns an array of primitives created by exploding,
    which you can erase or manipulate as top level entities
    The explode method doesn't erase the original object
    either, and preserves any application data attached to
    them. That's essentially what ncopy does, except that
    it doesn't have to erase uninterested objects, since it
    gets to decide which are added to the drawing, and which
    are not. That luxury requires ObjectARX.

    <advice>

    Using largely obsolete methodologies like (entmake) as a
    means of duplication (whether it is for the purpose of
    exploding or any other type of 'copy'), is no longer
    regarded as a viable or robust approach, because it does
    not 'play nice' with other user applications and the data
    they may associate with objects.

    If for example, the objects contained in your blocks
    have some application data attached to them (in the form
    of an XDictionary with XRecords, for example) the Explode
    method already knows how to copy and transform that data,
    unlike entmake/entget based methods. A similar problem
    related to the "entmake-approach" is that it breaks any
    inter-object reference stored in private application data.

    Although your particular circumstances may not make any
    of this an issue, that doesn't serve to legitimize using
    an inferior approach when there are better/other ways to
    acheive the objective, that take into account many of the
    issues mentioned above, as well as a few others.

    </advice>
     
    Tony Tanzillo, Apr 30, 2004
    #3
  4. Marcel Janmaat

    John Uhden Guest

    It may be your opinion that one wants to preserve all the data attached to the
    original object, but that's not an indicator of right or wrong; it's just your
    opinion. Most here preface such statements with "IMHO" or less humbly "IMO."
    Just maybe one wants to clone an object free from its ancestor's properties
    except for simple geometry, and avoid the need for deleting, and perhaps
    purging, the excess baggage created by copying. Maybe I've missed something,
    but I don't think xrefs are explodable, or that entmake has been retired.

    While I truly respect your experience, I detest your responses that are aimed
    purposefully at belittling contributors such as myself with your "holier than
    thou" attitude, accusations of inferiority, and contrived admonitions. If the
    programmer wishes, he can include the associations that you claim will be
    broken.

    It's a shame you demean yourself by demeaning others. IMHO, an opposite
    approach would serve us all much better.
     
    John Uhden, May 1, 2004
    #4
  5. Excuse me...

    Regardless of what you may have to say about my comments,
    fact of the matter is that a simple request for help with
    a minor programming problem posted in the customization
    newsgroup, was met with a response that is not in the
    least bit constructive; and amounts to nothing but a crude
    sales pitch, complete with a really scary comment about
    the use of (entmake), which on the surface, would easily
    mislead a less-experienced coder into believing that any
    solution to the NCOPY problem is far more complicated than
    it actually is.

    Remember, this is not an end-user asking for a canned
    solution. This is a person that's coding their own solution,
    who has come here seeking help with a problem they're having.

    This is the customization newsgroup. We don't peddle solutions
    to coding problems here, like rug merchants at a bazaar.
    We share knowledge and help others solve their problems with
    hands-on help and code (using best practices if I might add),
    and we do that, even when doing so may not be in our own
    commercial interest.

    Ask Terry Dotson how much fire he's drawn by proposing his
    product as the means of solving a coding problem someone has
    come here to ask for help with.

    I simply made it clear that the poster can easily arrive
    at the equivalent to the NCOPY functionality, without
    having to spend $150 (do they get source code for that
    outrageous price?), and can do it relatively easily with
    the use of the Explode method.

    Obviously, it is that aspect of my reply that you seem
    to have the biggest problem with.
     
    Tony Tanzillo, May 1, 2004
    #5
  6. Marcel Janmaat

    A. Fool Guest

    Tony,
    John has a point about the explode method. It won't work
    on xrefs. O'course I'd be happy for you to prove that the
    explode method can work on xrefs.

    For activeX to work on xrefs, the copyobjects method is
    necessary along with the transformby method. Of course,
    if extreme care is not taken with those methods, the session
    will crash. For instance, the copyobjects method can
    create the new object copied from the xref database on a
    layer <xrefname>|<layername>. That's fine until the xref
    is detached and an attempt is made to save the current
    drawing.....boom.

    Perhaps, if the command opened the xref drawing as
    a separate dbxdoc and then performed the copyobjects
    operation, everything would play nice.

    Entget/entmake is certainly more complex than the associated
    activeX operations to implement for all objects but I can't
    see that entget/entmake should be derogated to replace ncopy
    if already implemented and canned. The ncopy method
    does not preserve xdata from either xref objects or block
    objects. It hardly preserves any properties, including layer
    (probably for very good reasons). Neither does the
    copyobjects method preserve it from the xref if used
    on an attached xref. Though the explode method does
    preserve the xdata from block sub-entities, it can only be
    used on blocks.

    The Xoffset price seems a bit high to me also given the
    fact that ncopy is part of the freely available express tools,
    but if John can get it, then more power to him.

    Now both of you guys, chill and have a beer, then kiss and
    make up. ;-)

    Regards,
    A. Fool






    <snip>
     
    A. Fool, May 1, 2004
    #6
  7. Doug - I know Explode doesn't work with XREFS. Exploding and
    XREF binding are two different things.

    This is about exploding some objects from a block in the
    current document, not xref binding.

    My comments weren't specifically targeting John's solution
    but rather his general suggestion that the way to solve this
    particular problem (NCOPY equivalent with blocks only) was
    via (entmake).

    Regarding the equating of entmake with deep-cloning methods
    like CopyObjects, InsertBlock, Explode, etc., the problems
    with entmake go far beyond lack of support for deep cloning
    or translation of inter-object references.

    Another major downside is that when AutoCAD entities get new
    properties in new releases (for example, lineweights, true
    color, and so on), the ENTMAKE-based "copy" code breaks, and
    must be continuously revised to deal with those properties
    (you can't simply pass the entget result list to entmake,
    you have to manipulate it and insert things like (62 . 256)
    when a color field is missing from the entget result list).
    In contrast, when you use a deep-cloning method, there is
    no need to revise anything, to cope with new properties on
    entities.

    To make matters worse, word has it that many custom objects
    in the latest desktop products cannot even be created via
    entmake, and that's the reason why it is depreciated, or at
    least for the purpose of general processing of any kind of
    entity.

    PS: When I need to copy something from an XREF, I usually
    access the xref database directly via ObjectDBX, which
    works well for me.
     
    Tony Tanzillo, May 1, 2004
    #7
  8. Tony, if I may, I respectfully submit that ...

    Your programming expertise is rivaled by none and respected
    by all, but the school yard bullying thing only serves to
    diminish YOUR stature, not the recipient's, regardless that
    your point(s) may be perfectly valid.

    Also, while you can deftly steer a thread to the areas where
    you sport an advantage or away from those points you do not
    wish to address or acknowledge, valid points your opponents
    make are not lost in the melee.

    To be fair, I am aware that the tone you take with some
    folks is the result of historical conflicts, and as a
    result, we may not fully appreciate why there seems to be
    disproportionate hostility or belittlement being directed at
    what appears to be a seemingly innocent post.

    Not that I have any empirical data to draw on.

    Still, history or not, you have set the bar in so very many
    different respects, why stop at coding eloquence?

    For what it is worth I agree with the issues you flagged,
    just not the manner in which you choose to deliver them.

    It has been said that those things we tell other people are
    frequently the very things we need to learn ourselves, so
    this thread, and my post, are not lost on me.

    Hoping you can accept this as constructive input.

    Have a great weekend one and all; take in some nature.

    Michael.
     
    michael puckett, May 1, 2004
    #8
  9. Marcel - Let me apologize for the 'infighting' that this
    thread has spawned.

    Let me also repeat the most imporant point of my original
    reply, which is that your need to emulate the functionality
    of NCOPY is very easy to do using the vla-Explode ActiveX
    method.

    If you're not sure how to go about it, just say so and
    I'll be happy to post an example.
     
    Tony Tanzillo, May 2, 2004
    #9
  10. Tony, if I may, I respectfully submit that ...
    Michael - When you start off like this, it only
    serves to ensure that the remainder of the message
    will not be read by me.

    Have a nice day.

    --

    Best Regards,
    Tony Tanzillo,
    Design Automation Consulting
    http://www.caddzone.com
     
    Tony Tanzillo, May 2, 2004
    #10
  11. I have not failed. I just identified 10,000 ways that don't work.
    - Thomas Edison

    Have a good day all.

    Sincerely,

    Michael.
     
    michael puckett, May 2, 2004
    #11
  12. Marcel Janmaat

    John Uhden Guest

    I had a draft response almost as vile as yours, but had sense enough to discard
    it. Rather I'd appreciate your demonstrating the explode technique.

    BTW...
    Yes you can entmake AECC_CONTOUR, AEC_CURVETEXT, AECC_POINT, and AECC_GRADE
    objects.
    In representing my price, you failed to mention it is for a site license
    (unlimited users). Mom'n'Pop operations get heavy discounts, sometimes 100%.
     
    John Uhden, May 2, 2004
    #12
  13. Thanx Tony! About the 'infighting', I don't care aslong as i get to what
    i'm looking for. I even thought it was more or less amusing.
    I think vla-Explode is what i need. But an example is always welcome.
    Unfortunatly i cannot spend all of my time on programming. I'm gonna try it
    later on.

    MJ
     
    Marcel Janmaat, May 3, 2004
    #13
  14. I can't seem to find vla-explode.

    MJ

     
    Marcel Janmaat, May 3, 2004
    #14
  15. This takes the entity name of the block insertion,
    and returns a list of entity names of the primitives
    created by exploding the block insert.

    Use them, and erase them when done, or keep what you
    want, and erase what you don't need. The original
    block reference will not be erased.

    ;; No error checking!

    (defun explode (ename)
    (mapcar
    'vlax-vla-object->ename
    (vlax-safeArray->list
    (vlax-variant-value
    (vla-Explode (vlax-ename->vla-object ename))
    )
    )
    )
    )
     
    Tony Tanzillo, May 3, 2004
    #15
  16. I'm not looking for a prepackaged ready to use component. Just looking for
    some help from more experienced programmers if i get stuck with programming.
    Isn't this what this newsgroup is for? If i'm mistaken, please let me know?
    I "think" i 'm resonably experienced myself, but unfortunatly mostly have
    verry little time replying to programming questions of others. Does this
    make me a bad newsgroup user?

    MJ
     
    Marcel Janmaat, May 3, 2004
    #16
  17. Marcel Janmaat

    Doug Broad Guest

    Marcel,
    What version of AutoCAD do you have?
    Did Tony's function work for you?
    If not, did you use (vl-load-com) before his routine?

    You won't find vla-anything in the help files. Instead
    type explode in the vlide help search and you will
    find how to use the explode method. There is
    a translation process for activeX.

    Post what you have tried and we can help you from
    there. The more often you check the newsgroup for
    replies, the faster you can be helped.

    Regards,
    Doug
     
    Doug Broad, May 3, 2004
    #17
  18. Do you mean find it in the help? It's not in the
    Visual LISP help. It's an ActiveX method, which
    is only documented in VBA/ActiveX help. I realize
    that's not much help for Visual LISPers, but that's
    what Autodesk has seen fit to offer.

    The example I posted attempts to distance the caller
    from the ActiveX side of things by converting between
    entity names and ActiveX objects.
     
    Tony Tanzillo, May 3, 2004
    #18
  19. Marcel Janmaat

    John Uhden Guest

    No, no, Marcel. Your question was perfectly fine. Unfortunately, my mention of
    (entmake) aroused some ire which took the thread off into a stupid argument. My
    apologies to you.

    We should get back on track to see what would help you best.
     
    John Uhden, May 4, 2004
    #19
  20. Sorry i'd mistaken your words. Never the less I was wondering if there a
    sort of code on how to behave in a newsgroupe.
    Is it rude to just gather information of others end not give input myself?
    Do you guys get paid for this by AutoDesk? Do i have to see this strictly as
    a service of Autodesk wich i can adress to?

    MJ
     
    Marcel Janmaat, May 4, 2004
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.