Forced update of MDT assembly constraints?

Forced update of MDT assembly constraints?

Anonymous
Not applicable
205 Views
4 Replies
Message 1 of 5

Forced update of MDT assembly constraints?

Anonymous
Not applicable
I am using the follow lines of code to update the 3D assembly constraints in
MDT:

Dim mapp As McadApplication
Set mapp =
ThisDrawing.Application.GetInterfaceObject("Mcad.Application")
mapp.ActiveDocument.AssemblyMgr.Update

However, there are two problems:

1) If there are any externally references parts or assemblies, I get a
"Run-time error '-2147196429': The component definition is external." Any
way to update assembly constaints that contain xrefs?

2) The update doesn't occur until the VBA program exits. I really want to
force the update to occur immediately.

Thanks,

Benjamin
0 Likes
206 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Hi Benjamin,

I had the same problem with a simple animation program. The only way I could
get it to update during VBA execution was to use "Sendcommand" and
"amupdate". If you find a better way I'd love to hear about it.

Gary
0 Likes
Message 3 of 5

Anonymous
Not applicable
I haven't been able to get sendcommand to update the assembly. When I run
amupdate from sendcommand it seems to eliminate the assembly option and it
will only update parts.

"Gary McMaster" wrote in message
news:06F679077BA1842535A86015BBF3D5BB@in.WebX.maYIadrTaRb...
> Hi Benjamin,
>
> I had the same problem with a simple animation program. The only way I
could
> get it to update during VBA execution was to use "Sendcommand" and
> "amupdate". If you find a better way I'd love to hear about it.
>
> Gary
>
0 Likes
Message 4 of 5

Anonymous
Not applicable
My app is reading global variables from an Excel sheet which are used to
drive one or more constraints. I'm using statements something like those
below to cause the assembly to update between each change in the variables.
I don't like using "Sendcommand", but as you pointed out the assembly
doesn't update until the VBA finishes. This workaround has been doing the
job so far.

Dim oMCADApp As McadApplication
Dim oMcadDoc As McadDocument

Set oMCADApp =
ThisDrawing.Application.GetInterfaceObject("MCAD.Application")
Set oMcadDoc = oMCADApp.ActiveDocument
.
.
.
'Update global constraint variables
.
.
.
oMcadDoc.AssemblyMgr.Update
ThisDrawing.SendCommand ("AMUPDATE" & vbCrLf)

Gary
0 Likes
Message 5 of 5

Anonymous
Not applicable
I still get an error on the oMcadDoc.AssemblyMgr.Update command when I have
externally referenced parts in the assembly. I was thinking maybe I could
run a LISP program that will do the assembly update, but I don't have much
experience in LISP. Otherwise, I guess I'll have to internalize the parts
if I want to move them.

Thanks for the suggestions.

Benjamin

"Gary McMaster" wrote in message
news:FD65C2B7BB7A6B611E67C25699285FE2@in.WebX.maYIadrTaRb...
> My app is reading global variables from an Excel sheet which are used to
> drive one or more constraints. I'm using statements something like those
> below to cause the assembly to update between each change in the
variables.
> I don't like using "Sendcommand", but as you pointed out the assembly
> doesn't update until the VBA finishes. This workaround has been doing the
> job so far.
>
> Dim oMCADApp As McadApplication
> Dim oMcadDoc As McadDocument
>
> Set oMCADApp =
> ThisDrawing.Application.GetInterfaceObject("MCAD.Application")
> Set oMcadDoc = oMCADApp.ActiveDocument
> .
> .
> .
> 'Update global constraint variables
> .
> .
> .
> oMcadDoc.AssemblyMgr.Update
> ThisDrawing.SendCommand ("AMUPDATE" & vbCrLf)
>
> Gary
>
0 Likes