• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

extract parameters from a desktop mechanical drawing

  • Thread starter Thread starter Nenma
  • Start date Start date

Nenma

Guest
Good morning I have a problem in being able to extract the parametric data of the mechanical desktop autocad blocks in practice I can not find where the parameters that regulate the block are saved
the object and type "amgstdpart"

Unfortunately I don't find and I haven't found anything even in the autodesk forums if someone can help me deal with this problem I'd be very grateful
 
Okay, you want some code, too? If you don't have my bookstores, can you see them anyway? cmq we try.. .

I attached the standard part "structure".... my idea was to clikkarci over and recover in a variable the size you see in the details section under the item "dimensions"
 

Attachments

I'm sorry, without mechanics I can't even see the dwg, with cadworx I see it but in any case without the structure of the data it is really hostical to understand where to look.
 
Good morning I have a problem in being able to extract the parametric data of the mechanical desktop autocad blocks in practice I can not find where the parameters that regulate the block are saved
the object and type "amgstdpart"

Unfortunately I don't find and I haven't found anything even in the autodesk forums if someone can help me deal with this problem I'd be very grateful
in mechanical with the classic autolisp functions (entsel, entget ...) for the query of the data of an object get lists of encoded data.

I attach a txt in which I show you an example of results.
You will notice that in the list there are fields such as (300 . "2100") and (300 . "1000") that represent the height and width of the larger component.
 

Attachments

in mechanical with the classic autolisp functions (entsel, entget ...) for the query of the data of an object get lists of encoded data.

I attach a txt in which I show you an example of results.
You will notice that in the list there are fields such as (300 . "2100") and (300 . "1000") that represent the height and width of the larger component.
Thank you very much. Do you have any idea how I can bring those values into a vba array? my idea was to click (getobject) on one or more objects and then make the code do the rest of the calculations.. .
 
in mechanical with the classic autolisp functions (entsel, entget ...) for the query of the data of an object get lists of encoded data.

I attach a txt in which I show you an example of results.
You will notice that in the list there are fields such as (300 . "2100") and (300 . "1000") that represent the height and width of the larger component.
So I'm making progress but don't abandon me?

the code below makes a cycle of all standard parts in the design "amgstdpart"... shows the name and description of the view.... now I have to be able to do more for example to change the parameters. and even if possible insert them into the drawing by code....


Code:
public sub provarecuperopartistandard()
    ' reference to acadmapplication
    dim mcad as acadmapplication
    set mcad = thisdrawing.application.getinterfaceobject("acadmauto.acadmapplication")

    ' get mcad2dstructuremgr
    dim structmgr as mcad2dstructuremgr
    set structmgr = mcad.activedocument.structuremgr2d

' create mcad2dstdpartcompgroupdescriptor
    dim compgroup1 as mcad2dstdpartcomponentdescriptor
    set compgroup1 = structmgr.create2dstdpartcomponentdescriptor
  
    dim powviews1() as mcadstdpartcomponentviewdescriptor
    powviews1 = structmgr.getsinglestdpartviewsformigr

    dim view1 as variant
    dim powview1 as mcadstdpartcomponentviewdescriptor
  
    for each view1 in powviews1
      
        'if typeof view1 is mcadstdpartcomponentviewdescriptor then
            'set powview1 = view1
            'icompgroup.addview powview1
            'msgbox ""
        'end if
       
           set powview1 = view1
           msgbox view1.fullviewname & "-" & view1.name
    
    
  
    next



end sub
 
So I'm making progress but don't abandon me?

the code below makes a cycle of all standard parts in the design "amgstdpart"... shows the name and description of the view.... now I have to be able to do more for example to change the parameters. and even if possible insert them into the drawing by code....


Code:
public sub provarecuperopartistandard()
    ' reference to acadmapplication
    dim mcad as acadmapplication
    set mcad = thisdrawing.application.getinterfaceobject("acadmauto.acadmapplication")

    ' get mcad2dstructuremgr
    dim structmgr as mcad2dstructuremgr
    set structmgr = mcad.activedocument.structuremgr2d

' create mcad2dstdpartcompgroupdescriptor
    dim compgroup1 as mcad2dstdpartcomponentdescriptor
    set compgroup1 = structmgr.create2dstdpartcomponentdescriptor

    dim powviews1() as mcadstdpartcomponentviewdescriptor
    powviews1 = structmgr.getsinglestdpartviewsformigr

    dim view1 as variant
    dim powview1 as mcadstdpartcomponentviewdescriptor

    for each view1 in powviews1
    
        'if typeof view1 is mcadstdpartcomponentviewdescriptor then
            'set powview1 = view1
            'icompgroup.addview powview1
            'msgbox ""
        'end if
     
           set powview1 = view1
           msgbox view1.fullviewname & "-" & view1.name
  
  

    next



end sub
I'm sorry. I can't help you.
in mechanical bees the descriptions are not very present and to understand what you get you have to test practically their operation.

there will be methods to get the property (height, width...) directly from the object... (? )
 
I could help you by connecting me to remote desktop, not having mechanical can't see anything
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top