Hello Shaun,
While I am not quite sure I understand the exact reason of your problem, I would propose couple of hints, perhaps it will help.
> Hello,
> I am attempting to attach additional data to
> entities in a STEP file and am having
> trouble. From an earlier suggestion I have
> tried writing code that uses AddWithRefs(),
> but I always get a, "Nothing to
> write", error. Here is some code that I
> used to see if I could attach the text:
> "SYS_LVL" as a unique entity that
> refers back to a part:
> Handle(Transfer_FinderProcess) findProc =
> writer.WS()->TransferWriter()->FinderProcess();
> IFSelect_ReturnStatus status =
> writer.Transfer( assembly->getShape(),
> STEPControlStd_AsIs );
> Handle(TransferBRep_ShapeMapper) mapper =
> TransferBRep::ShapeMapper( findProc,
> assembly->getShape() );
> Handle(StepVisual_TextLiteral) sysLevelPart
> = new StepVisual_TextLiteral();
> Handle( TCollection_HAsciiString )
> sysLvlName =
> new TCollection_HAsciiString(
> "SYS_LVL" );
> sysLevelPart->SetName( sysLvlName );
Unfortunately, it is not enough to set only a name to this entity. To get it correct, you have to feed it with all the relevant data. Use the second method Init() (with 6 arguments, see CDL or HXX) to do this.
> writer.Model()->AddWithRefs(
> sysLevelPart, 5 );
> The value of '5' in AddWithRefs() is not
> what I eventually want, but I don't know
> what to put there. Since there is no
> documentation for this low level function, I
> am just trying to decide what it does.
The documentation is in CDL, try to find it and have a look. For function AddWithRefs, use only first argument: the second will be 0 by default, this simply means that your entity will be added with all its references recursively.
> Eventually I want to be able to add boolean,
> integer, floating point and character data
> to the file as well. Can anyone please tell
> me how to do this?
It depends on meaning of that data, see STEP standard
Best Regards,
Commenter-1
> Thanks,
> -- Shaun Bloom