Author Topic: Positional Representations (Like Inventor) in AutoCAd  (Read 2654 times)

0 Members and 1 Guest are viewing this topic.

Ben Clark

  • Newt
  • Posts: 94
Positional Representations (Like Inventor) in AutoCAd
« on: January 15, 2018, 05:22:00 PM »
So I set out to emulate pos-reps (positional representations) in AutoCAD like Inventor has. If you're unfamiliar with them, they're basically a saved position/orientation/visibility state of the model. For example, you could have a the arms of an excavator in different positions saved as different pos-reps. You could then assign a pos-rep to a viewport and plot a layout of a handful of the different positions the arms can be in.

There are other ways to achieve this in ACAD. You could copy the model over many times and use layer states and apply them in certain viewports etc. This is really messy because now you have many different instances of the same objects, and gets especially bad for things like sequences of events. A pos-rep style implementation would be a lot cleaner.

I have a pretty good system going. I've got a manger type menu that allows you to save and restore "model states", which are nothing more than lists of insert points, rotations, normals, visilbilty, and dynamic properties of all the blocks in model space. The data is stored in vlax ldata so it can be recalled even after save/close/re-open.

The crux: I can't think of any way to "assign" a model state to a viewport in such a way that sticks. My first thought: is there any way to work with multiple instances of model space in a single dwg? I don't think there is.

Another thought is writing a routine that would allow the user to select a model state and then click a viewport. The routine would then make faux layers and copy objects into them that represent the selected model state and then vp freeze/thaw appropriately in that viewport. This seems overly messy and defeats the original purpose.




Maybe I'm chasing a pipe dream here and this isn't possible. Any other thoughts or solutions?
« Last Edit: January 15, 2018, 05:27:22 PM by Ben Clark »

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Positional Representations (Like Inventor) in AutoCAd
« Reply #1 on: January 15, 2018, 06:45:26 PM »
If you are talking about Inventor Pro (which is a separate program from AutoCAD):
It would be easier to automate such process through the Inventor's Object Model - although still will have to be familiar with its structure, properties and methods and having that additional autodesk program installed.
Cannot tell anything about the other Inventor/Fusion, which is in correlation with ACAD - it requires lisper thats been using it, to answer you.
Else if you are refering to do something with the plain AutoCAD from the 3D solids you have there - probably a 3D lisper guy like Marko Ribar could help you.
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Positional Representations (Like Inventor) in AutoCAd
« Reply #2 on: January 16, 2018, 03:56:36 AM »
It is possible to attach custom data to a VP (xdata or extension dictionary). So assigning a 'model state' is possible. To actually apply a state I think a reactor based solution should be considered, relying on consistent user action is too risky. Displaying two states on the same layout would indeed not be possible without copying (parts of) the model.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Positional Representations (Like Inventor) in AutoCAd
« Reply #3 on: January 16, 2018, 10:18:10 AM »
The most basic way would be to have multiple copies, not necessarily on different layers but that can make it easier.  There is also the Visible property which can be manipulated.  Generic process would be to have a function to "Create new viewrep" which copies the objects and then tags them using XDATA or Extension Dictionary/XRecords with an ID.  While a particular viewrep is active all objects not for that viewrep can be set to hidden.  They can be moved, rotated, etc. using normal AutoCAD commands.

A slightly more complicated way of doing it would involve storing transformation matrices for each object.  That way there isn't a need to duplicate the objects, instead when a viewrep is made active the appropriate objects are modified by the associated transform (rotate/move/scale) and the rest are hidden.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Ben Clark

  • Newt
  • Posts: 94
Re: Positional Representations (Like Inventor) in AutoCAd
« Reply #4 on: January 16, 2018, 10:44:48 AM »
A slightly more complicated way of doing it would involve storing transformation matrices for each object.  That way there isn't a need to duplicate the objects, instead when a viewrep is made active the appropriate objects are modified by the associated transform (rotate/move/scale) and the rest are hidden.

Thanks for the reply. This is exactly what I have going and I see a lot of benefit to not having multiple copies of objects.

I can't figure out how to apply these viewreps/posreps to a viewport in paper space though. That's the problem I have now.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Positional Representations (Like Inventor) in AutoCAd
« Reply #5 on: January 16, 2018, 12:18:59 PM »
You would not apply such a 'viewreps/posreps' state to a viewport but to entities in model space when the layout with that VP is activated.

Ben Clark

  • Newt
  • Posts: 94
Re: Positional Representations (Like Inventor) in AutoCAd
« Reply #6 on: January 16, 2018, 01:12:47 PM »
You would not apply such a 'viewreps/posreps' state to a viewport but to entities in model space when the layout with that VP is activated.

Currently when I do that, every single viewport changes as well, even if they aren't activated.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Positional Representations (Like Inventor) in AutoCAd
« Reply #7 on: January 16, 2018, 01:49:23 PM »
Yeah, if you're viewing the same set of objects with different viewports they're always going to be identical - all viewports point to the same, single model space.  If you want different viewreps for separate viewports in the same layout then you need to get very creative e.g. spin off a separate DWG file for each viewrep, then XREF them in; then you can freeze the layers per-viewport per-XREF layer.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Ben Clark

  • Newt
  • Posts: 94
Re: Positional Representations (Like Inventor) in AutoCAd
« Reply #8 on: January 16, 2018, 03:39:39 PM »
Yeah, if you're viewing the same set of objects with different viewports they're always going to be identical - all viewports point to the same, single model space.  If you want different viewreps for separate viewports in the same layout then you need to get very creative e.g. spin off a separate DWG file for each viewrep, then XREF them in; then you can freeze the layers per-viewport per-XREF layer.

I figured this was the case. Thanks for helping me think it through.

I was basically hoping that vlisp object properties could be different for different viewports. It seems this probably isn't the case.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Positional Representations (Like Inventor) in AutoCAd
« Reply #9 on: January 17, 2018, 03:04:48 AM »
An alternative approach:
Superimpose multiple viewports. Each depicting one part of the model. The model is fixed, the viewports are realigned to reposition the parts. Requires dedicated layers for each part.