+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Junior Member
    Discipline
    Manufacture
    Using
    AutoCAD 2014
    Join Date
    Oct 2017
    Posts
    21

    Default VLA Create Block Definition and Add Entity...

    Registered forum members do not see this ad.

    I seem to be stuck..
    Combed through all the documentation plus google searches...

    What am I missing?
    Can't seem to add object to my block definition...

    vl-load-com loaded
    ActiveDocument loaded...
    Acad-Object loaded...

    Code:
    (setq fax (vlax-ename->vla-object far)) ;returns #<VLA-OBJECT IAcadSolid 0000024d51846d98>
    (setq blk (vla-get-Blocks doc)) ;returns #<VLA-OBJECT IAcadBlocks 0000024d3ecb3a38>
    (setq fab (vla-Add blk fpa "_ClosedFilled")) ;returns #<VLA-OBJECT IAcadBlock 0000024d37310cf8>
    (setq fax (vla-CopyObjects doc fax fab)) ;returns nothing!!!!????
    Your thoughts?............

  2. #2
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,159
    A man who never made mistakes never made anything

  3. #3
    Junior Member
    Discipline
    Manufacture
    Using
    AutoCAD 2014
    Join Date
    Oct 2017
    Posts
    21

    Default

    I followed your link BIGAL... all the way to Lee Mac's "AddObjectstoBlock" lisp.... I see similar syntax in his routine:

    (vla-CopyObjects (ActiveDoc variable) (list of objects to add) (block reference name))

    I still don't get why mine won't work... I'm thinking maybe I have either the entity variable or the block reference variable in an improper form... maybe i cannot add the single entity i get from "vlax-ename->vla-object x"... maybe it expects an selection set array... maybe it expects some other info before it can add the object.... i don't know...

  4. #4
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,124

    Default

    Hi,

    To avoid the safearray just use the vlax-invoke instead besides that you need to have your vla-object(s) as a list.

    Code:
    (vlax-invoke doc 'CopyObjects (list fax) fab)

  5. #5
    Junior Member
    Discipline
    Manufacture
    Using
    AutoCAD 2014
    Join Date
    Oct 2017
    Posts
    21

    Default

    oooh! wow... I spent the whole day spinning my wheels.. Thanks Tharwat... I'll try it out and report back....

    funny thing is I tried this method as well but without list.. same nil..

    So just to be clear though... the first method does require a safearray of objects? Also can a safearray contain a single object? just for future reference...

    Thank you both!

  6. #6
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,124

    Default

    Quote Originally Posted by eimimitu View Post
    oooh! wow... I spent the whole day spinning my wheels.. Thanks Tharwat... I'll try it out and report back....

    funny thing is I tried this method as well but without list.. same nil..

    So just to be clear though... the first method does require a safearray of objects? Also can a safearray contain a single object? just for future reference...
    You are welcome.

    Certainly, have a look at the following for your reference that contains a single object ( and not married one. ).
    Code:
    (setq safe (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element safe 0 fax)
    
    (vla-CopyObjects doc safe fab)

  7. #7
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,283

    Default

    I always forget that the methods sometimes require safearrays...
    Makes me think does a variant type of argument is required anywhere? So one would be forced to use vlax-make-variant function.

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,457
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  9. #9
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,283

    Default

    Quote Originally Posted by Lee Mac View Post
    Veery nice, in conjunction with this, one could store selection sets to be previewed in DCL.

  10. #10
    Junior Member
    Discipline
    Manufacture
    Using
    AutoCAD 2014
    Join Date
    Oct 2017
    Posts
    21

    Default

    Registered forum members do not see this ad.

    good (- 3 2) Tharwat Some objects just aren't ready to settle down...

    It worked... freakin' brillant! TY!

Similar Threads

  1. How to create boundary box with spline entity?
    By kwwong6 in forum AutoLISP, Visual LISP & DCL
    Replies: 51
    Last Post: 10th Mar 2015, 10:32 am
  2. create block with N last entity
    By metaldan in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 22nd Feb 2014, 03:12 am
  3. Slicing in 3D wants me to create a block definition?
    By TED Jordan in forum AutoCAD 3D Modelling & Rendering
    Replies: 4
    Last Post: 4th Jul 2013, 04:46 pm
  4. Block Definition
    By criehle in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 13th Jul 2009, 06:47 pm
  5. Create image entity using entmake?
    By Treddin in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 9th Jul 2008, 06:49 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts